2020-06-13 13:50:34 +02:00
|
|
|
local CHUNK_SIZE = 16;
|
|
|
|
|
|
|
|
-- Contains functions for converting coordinates between world units and the
|
|
|
|
-- unit used by cartographer's maps
|
|
|
|
return {
|
|
|
|
-- Convert world coordinates to map coordinates
|
|
|
|
-- coord: The coordinate value
|
2020-06-13 14:01:56 +02:00
|
|
|
--
|
|
|
|
-- Returns a coordinate value in map space
|
2020-06-13 13:50:34 +02:00
|
|
|
to = function(coord)
|
|
|
|
return math.floor(coord / CHUNK_SIZE);
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- Convert map coordinates to world coordinates
|
|
|
|
-- coord: The coordinate value
|
2020-06-13 14:01:56 +02:00
|
|
|
--
|
|
|
|
-- Returns a coordinate value in world space
|
2020-06-13 13:50:34 +02:00
|
|
|
from = function(coord)
|
|
|
|
return math.floor(coord * CHUNK_SIZE);
|
|
|
|
end
|
|
|
|
};
|