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