A minetest mod for mapmaking
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
597B

  1. local CHUNK_SIZE = 16;
  2. -- Contains functions for converting coordinates between world units and the
  3. -- unit used by cartographer's maps
  4. return {
  5. -- Convert world coordinates to map coordinates
  6. -- coord: The coordinate value
  7. --
  8. -- Returns a coordinate value in map space
  9. to = function(coord)
  10. return math.floor(coord / CHUNK_SIZE);
  11. end,
  12. -- Convert map coordinates to world coordinates
  13. -- coord: The coordinate value
  14. --
  15. -- Returns a coordinate value in world space
  16. from = function(coord)
  17. return math.floor(coord * CHUNK_SIZE);
  18. end
  19. };