forked from minetest/minetest_game
41c2b2aeea
Tested with nodebreaker, fire. If called from lua, minetest.remove_node() calls on_destruct() callbacks before the map is actually updated. This means that we can't look at the map data to determine if we're done cleaning up adjacent nodes, and we have to stop recursing some other way. There's no data we can pass around through functions that would survive scope to a secondary on_destruct() callback, so we have to maintain local state somewhere in the mod namespace. In this case, we keep a bitflag. The bitflag is set to "true" by default. On the first half removal, the flag is flipped and afterwards we remove the other half node. When the on_destruct for the other half is running, it's value is false and we flip it back to true without removing the other half node. This thus prevents recursing. To facilitate easier finding of the bed partner, we tell our on_destruct whether we're a top or bottom half node through a passed flag. Now that the top is diggable, we just need to assure that it drops a bottom bed part. |
||
---|---|---|
.. | ||
beds | ||
boats | ||
bones | ||
bucket | ||
creative | ||
default | ||
doors | ||
dye | ||
farming | ||
fire | ||
flowers | ||
give_initial_stuff | ||
screwdriver | ||
sethome | ||
stairs | ||
tnt | ||
vessels | ||
walls | ||
wool | ||
xpanes |