summaryrefslogtreecommitdiff
path: root/builtin/game
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2020-05-16 21:41:41 +0200
committerGitHub <noreply@github.com>2020-05-16 21:41:41 +0200
commitab745685c79cd7b0fa8f74b96e190c528d620608 (patch)
treedbdaa426685e3d148f833a948447dafab1e64119 /builtin/game
parenta08251a61e5c6f407621d04b2de4da6812410c66 (diff)
downloadminetest-ab745685c79cd7b0fa8f74b96e190c528d620608.tar.gz
minetest-ab745685c79cd7b0fa8f74b96e190c528d620608.tar.bz2
minetest-ab745685c79cd7b0fa8f74b96e190c528d620608.zip
Error msg if trying to teleport attached player (#9824)
Diffstat (limited to 'builtin/game')
-rw-r--r--builtin/game/chat.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/game/chat.lua b/builtin/game/chat.lua
index c8fa4175d..b9f84e522 100644
--- a/builtin/game/chat.lua
+++ b/builtin/game/chat.lua
@@ -443,6 +443,9 @@ core.register_chatcommand("teleport", {
end
local teleportee = core.get_player_by_name(name)
if teleportee then
+ if teleportee:get_attach() then
+ return false, "Can't teleport, you're attached to an object!"
+ end
teleportee:set_pos(p)
return true, "Teleporting to "..core.pos_to_string(p)
end
@@ -460,6 +463,9 @@ core.register_chatcommand("teleport", {
end
if teleportee and p then
+ if teleportee:get_attach() then
+ return false, "Can't teleport, you're attached to an object!"
+ end
p = find_free_position_near(p)
teleportee:set_pos(p)
return true, "Teleporting to " .. target_name
@@ -480,6 +486,9 @@ core.register_chatcommand("teleport", {
teleportee = core.get_player_by_name(teleportee_name)
end
if teleportee and p.x and p.y and p.z then
+ if teleportee:get_attach() then
+ return false, "Can't teleport, player is attached to an object!"
+ end
teleportee:set_pos(p)
return true, "Teleporting " .. teleportee_name
.. " to " .. core.pos_to_string(p)
@@ -498,6 +507,9 @@ core.register_chatcommand("teleport", {
end
end
if teleportee and p then
+ if teleportee:get_attach() then
+ return false, "Can't teleport, player is attached to an object!"
+ end
p = find_free_position_near(p)
teleportee:set_pos(p)
return true, "Teleporting " .. teleportee_name