Advertisement
Guest User

Untitled

a guest
Dec 7th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.13 KB | None | 0 0
  1. local BLOCKSIZE = core.MAP_BLOCKSIZE
  2.  
  3. local squarsize = 1024
  4.  
  5. local loadx = squarsize
  6. local loady = 256
  7. local loadz = squarsize
  8.  
  9. local loadxblocks = math.floor(loadx/BLOCKSIZE)
  10. local loadyblocks = math.floor(loady/BLOCKSIZE)
  11. local loadzblocks = math.floor(loadz/BLOCKSIZE)
  12.  
  13. local loadxblockshalf = math.floor(loadxblocks/2)
  14. local loadyblockshalf = math.floor(loadyblocks/2)
  15. local loadzblockshalf = math.floor(loadzblocks/2)
  16.  
  17. local pos1 = { x = - loadxblockshalf, y = - loadyblockshalf, z = - loadzblockshalf }
  18. local pos2 = { x = loadxblockshalf, y = loadyblockshalf, z = loadzblockshalf }
  19.  
  20.  
  21. function emerge()
  22.     minetest.emerge_area(pos1, pos2)
  23. end
  24.  
  25.  
  26. function loadmap()
  27.     minetest.chat_send_all("start force load")
  28.     for ix = - loadxblockshalf, loadxblockshalf , 1
  29.     do
  30.         for iy = - loadyblockshalf, loadyblockshalf , 1
  31.         do
  32.             for iz = - loadzblockshalf, loadzblockshalf , 1  
  33.             do  
  34.                 minetest.chat_send_all("loading " .. tostring(ix) .. " , " .. tostring(iy) ..  " , " .. tostring(iz) )
  35.                 minetest.chat_send_all(tostring(minetest.forceload_block({ x = ix*16, y = iy*16, z = iz*16 })))
  36.             end
  37.         end
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement