I found the bug!
The problem lies in the stability detection:
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
for z = z0, z1 do -- for each xy plane progressing northwards
for x = x0, x1 do
local si = x - x0 + 1
local nodename = minetest.get_node({x=x,y=y0-1,z=z}).name
if nodename == "air"
or nodename == "default:water_source" then
stable[si] = 0
else
stable[si] = STABLE
end
end
Looks OK, right? No. What if the node type is ignore? No wonder it was so clear cut, it was a typical MapBlock/chunk border (whatever) problem.
All that is needed for a fix is to check to check for ignore, too.
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
local si = x - x0 + 1
local nodename = minetest.get_node({x=x,y=y0-1,z=z}).name
if nodename == "air"
or nodename == "ignore"
or nodename == "default:water_source" then
stable[si] = 0
else
stable[si] = STABLE
end
If the code doesn’t know what is below the node, I assume the worst (there is air or water below it), which is the safest choice. If the assumption was wrong, this is not a problem, just some sand is removed then.
Actually, the code could be even improved further. Why limit ourselves to default:water_source? We can generalize that by checking wheather the node is not walkable (=passable for falling nodes). default:water_source is not walkable, air is not walkable either, so I can merge it.
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
local si = x - x0 + 1
local nodename = minetest.get_node({x=x,y=y0-1,z=z}).name
if nodename == "ignore"
or minetest.registered_nodes[nodename].walkable == false then
stable[si] = 0
else
stable[si] = STABLE
end
I tested it for myself on the screenshot positions. If you want to help, please test it for yourselves, too. Bring yourself to these positions and tell me wheather there is floating sand or not. For me, there was no more floating sand at these positions.