Improve do_not_move globalstep

Would ignore the fact that do not move was disabled and would also send extra messages to the player as `moved[name]` was not set to `false` after the teleportation was complete.
This commit is contained in:
octacian 2017-03-23 17:20:28 -07:00
parent b80cfda6df
commit 447be07cdc

View File

@ -23,7 +23,7 @@ minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()
if pos[name] then
if pos[name] and spawnpoint.do_not_move then
if not moved[name] and not vector.equals(pos[name], player:getpos()) then
moved[name] = true
@ -149,6 +149,9 @@ function spawnpoint.begin(player, time)
-- Send to chat
minetest.chat_send_player(name, "Teleportation successful!")
-- Prevent further callbacks from globalstep
moved[name] = true
end
end)
else