From f4b315852182c3f6305a3a1fdb7ba6a3ebdbb3c8 Mon Sep 17 00:00:00 2001 From: octacian Date: Wed, 22 Mar 2017 22:35:52 -0700 Subject: [PATCH] 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. --- init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 3afebb8..7a80443 100644 --- a/init.lua +++ b/init.lua @@ -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, })