cx384 wrote:How can I check where are mapblock and mapchunk borders?
Every 16 nodes and 5 mapblock, but where is the first mapblock?
From x=0 y=0 z=0 to x=15 y=15 z=15?
In trying to resolve my own issue I've gotten a more precise answer to your question, I think. If you take a position and put it through the following formula you get the minp and maxp of the generated mapchunk containing that position.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
pos = {x=1,y=1,z=1}--or whatever position you put in
pos.x,pos.y,pos.z = 80*math.floor((p.x+32)/80)-32,80*math.floor((p.y+32)/80)-32,80*math.floor((p.z+32)/80)-32
minp = pos --this works out to {x=-32,y=-32,z=-32} for the given position pos
maxp = {y=p.y+79,x=p.x+79,z=p.z+79}--this works out to {x=47,y=47,z=47}
This implies that the center mapblock of nodes starts at {x=0,y=0,z=0} and goes to {x=15,y=15,z=15}. I inferred this by adding
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.chat_send_all(minetest.serialize(minp))
minetest.chat_send_all(minetest.serialize(maxp))
to my on_generated function to get feedback on where and when that was being called.
Hopefully I'll be able to use that to make a chatcommand that invokes my on_generated function on existing mapchunks I want to convert.