From 47c3d23da05217ffc19ad5a61da09ef71558e71c Mon Sep 17 00:00:00 2001 From: Robert Zenz Date: Tue, 28 Jul 2015 20:20:18 +0200 Subject: [PATCH] Fixed a possible endless loop. --- mods/spawn_usher/spawnusher.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mods/spawn_usher/spawnusher.lua b/mods/spawn_usher/spawnusher.lua index d3252bc..a5aefab 100644 --- a/mods/spawn_usher/spawnusher.lua +++ b/mods/spawn_usher/spawnusher.lua @@ -185,7 +185,18 @@ function spawnusher.move_player(player) -- The node beneath is neither air nor ignore and there is no -- air bubble big enough, lets go upwards and see if that -- helps. - pos.y = pos.y + 2 + while mathutil.in_range(pos.y, -31000, 31000) do + pos.y = pos.y + 1 + + local upward_node = minetest.get_node(pos).name + + if upward_node == "ignore" then + spawnusher.move_later(player, pos) + return + elseif upward_node ~= "air" then + break + end + end end elseif current == "ignore" then -- The current node is ignore, which means we need to retry later.