Weird? I managed to series teleport myself in the sky.

Somehow the correction didn't set my proper spawn_pos. And
it flung me to my death. Don't just modify Y unless we're
actually near the box spawn.
This commit is contained in:
Auke Kok 2019-01-25 22:58:00 -08:00
parent 80738b06b7
commit ff881a175b

View File

@ -375,7 +375,11 @@ function boxes.open_box(player, box_id_list)
local p = player:get_pos()
if p and p.y < spawn_pos.y - 0.95 and boxes.players_in_boxes[name] then
minetest.log("error", name .. " fell from an entrance lobby")
player:set_pos({x = p.x, y = spawn_pos.y + 0.5, z = p.z})
if (math.abs(spawn_pos.x - p.x) < 2) and (math.abs(spawn_pos.z - p.z) < 2) then
player:set_pos({x = p.x, y = spawn_pos.y + 0.5, z = p.z})
else
player:set_pos(spawn_pos)
end
end
end)
end