Skip to content

Commit

Permalink
Error msg if trying to teleport attached player (#9824)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 committed May 16, 2020
1 parent a08251a commit ab74568
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions builtin/game/chat.lua
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit ab74568

Please sign in to comment.