forked from Mineclonia/Mineclonia
Fix C stack overflow upon portal destruction
Destroying a nether portal could cause a C stack overflow for large portals when not using luajit. This patch defers removal of the "next batch" of portal nodes to the next globalstep via minetest.after. This has the additional bonus of a neat visual effect depending on server conditions.
This commit is contained in:
parent
de9f2479eb
commit
ae2c60722f
|
@ -93,14 +93,20 @@ local function destroy_nether_portal(pos)
|
|||
return
|
||||
end
|
||||
if orientation == 0 then
|
||||
minetest.after(0,function()
|
||||
check_remove({x = pos.x - 1, y = pos.y, z = pos.z}, 0)
|
||||
check_remove({x = pos.x + 1, y = pos.y, z = pos.z}, 0)
|
||||
end)
|
||||
else
|
||||
minetest.after(0,function()
|
||||
check_remove({x = pos.x, y = pos.y, z = pos.z - 1}, 1)
|
||||
check_remove({x = pos.x, y = pos.y, z = pos.z + 1}, 1)
|
||||
end)
|
||||
end
|
||||
minetest.after(0,function()
|
||||
check_remove({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
check_remove({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||
end)
|
||||
end
|
||||
|
||||
minetest.register_node("mcl_portals:portal", {
|
||||
|
|
Loading…
Reference in New Issue