forked from Wuzzy/realtest_mt5
Fix crashy nodeupdate_single function
This commit is contained in:
parent
0a48ecce85
commit
6cb42ea745
|
@ -32,7 +32,7 @@ function realtest.register_on_updatenode(func)
|
||||||
end
|
end
|
||||||
minetest.register_on_updatenode = realtest.register_on_updatenode
|
minetest.register_on_updatenode = realtest.register_on_updatenode
|
||||||
|
|
||||||
local function nodeupdate_single(pos)
|
function realtest.nodeupdate_single(pos)
|
||||||
for _, callback in ipairs(realtest.registered_on_updatenodes) do
|
for _, callback in ipairs(realtest.registered_on_updatenodes) do
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
callback(pos, node)
|
callback(pos, node)
|
||||||
|
@ -44,7 +44,7 @@ function minetest.check_for_falling(pos)
|
||||||
for y = -1,1 do
|
for y = -1,1 do
|
||||||
for z = -1,1 do
|
for z = -1,1 do
|
||||||
local pos2 = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
|
local pos2 = {x=pos.x+x, y=pos.y+y, z=pos.z+z}
|
||||||
nodeupdate_single(pos2)
|
realtest.nodeupdate_single(pos2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -87,7 +87,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
on_falling = function(pos, node)
|
on_falling = function(pos, node)
|
||||||
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -115,7 +115,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
on_falling = function(pos, node)
|
on_falling = function(pos, node)
|
||||||
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -130,7 +130,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
on_falling = function(pos, node)
|
on_falling = function(pos, node)
|
||||||
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -147,7 +147,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
}),
|
}),
|
||||||
on_falling = function(pos, node)
|
on_falling = function(pos, node)
|
||||||
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
minetest.set_node(pos, {name = farm_nofarm[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -192,7 +192,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
if (n.liquidtype and n.liquidtype ~= "none") then
|
if (n.liquidtype and n.liquidtype ~= "none") then
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
minetest.set_node(pos, {name=grass_nograss[node.name]})
|
minetest.set_node(pos, {name=grass_nograss[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -228,7 +228,7 @@ function realtest.register_dirt(name, DirtRef)
|
||||||
if obj:is_player() then
|
if obj:is_player() then
|
||||||
if minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name].buildable_to then
|
if minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name].buildable_to then
|
||||||
minetest.set_node(pos, {name=grass_nograss[node.name]})
|
minetest.set_node(pos, {name=grass_nograss[node.name]})
|
||||||
nodeupdate_single(pos)
|
realtest.nodeupdate_single(pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue