Fix `do_not_move`

Would send message stating that the teleportation was interrupted but the player would still be teleported. This adds a check just before teleportation to make sure that the player hasn't moved.
master
octacian 2017-03-22 22:35:52 -07:00
parent f343dcae3d
commit f4b3158521
1 changed files with 7 additions and 5 deletions

View File

@ -117,11 +117,13 @@ function spawnpoint.begin(player, time)
return
end
player:hud_remove(hud)
spawnpoint.bring(player)
if vector.equals(pos, player:get_pos()) then
player:hud_remove(hud)
spawnpoint.bring(player)
-- Send to chat
minetest.chat_send_player(name, "Teleportation successful!")
-- Send to chat
minetest.chat_send_player(name, "Teleportation successful!")
end
end)
else
minetest.after(i, function()
@ -215,7 +217,7 @@ minetest.register_chatcommand("spawnpoint", {
if spawnpoint.pos then
pos = minetest.pos_to_string(spawnpoint.pos)
end
return true, "SpawnPoint Position: "..pos
end,
})