Error msg if trying to teleport attached player (#9824)
This commit is contained in:
parent
76ebe80e55
commit
10f3a97a91
|
@ -443,6 +443,9 @@ core.register_chatcommand("teleport", {
|
||||||
end
|
end
|
||||||
local teleportee = core.get_player_by_name(name)
|
local teleportee = core.get_player_by_name(name)
|
||||||
if teleportee then
|
if teleportee then
|
||||||
|
if teleportee:get_attach() then
|
||||||
|
return false, "Can't teleport, you're attached to an object!"
|
||||||
|
end
|
||||||
teleportee:set_pos(p)
|
teleportee:set_pos(p)
|
||||||
return true, "Teleporting to "..core.pos_to_string(p)
|
return true, "Teleporting to "..core.pos_to_string(p)
|
||||||
end
|
end
|
||||||
|
@ -460,6 +463,9 @@ core.register_chatcommand("teleport", {
|
||||||
end
|
end
|
||||||
|
|
||||||
if teleportee and p then
|
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)
|
p = find_free_position_near(p)
|
||||||
teleportee:set_pos(p)
|
teleportee:set_pos(p)
|
||||||
return true, "Teleporting to " .. target_name
|
return true, "Teleporting to " .. target_name
|
||||||
|
@ -480,6 +486,9 @@ core.register_chatcommand("teleport", {
|
||||||
teleportee = core.get_player_by_name(teleportee_name)
|
teleportee = core.get_player_by_name(teleportee_name)
|
||||||
end
|
end
|
||||||
if teleportee and p.x and p.y and p.z then
|
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)
|
teleportee:set_pos(p)
|
||||||
return true, "Teleporting " .. teleportee_name
|
return true, "Teleporting " .. teleportee_name
|
||||||
.. " to " .. core.pos_to_string(p)
|
.. " to " .. core.pos_to_string(p)
|
||||||
|
@ -498,6 +507,9 @@ core.register_chatcommand("teleport", {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if teleportee and p then
|
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)
|
p = find_free_position_near(p)
|
||||||
teleportee:set_pos(p)
|
teleportee:set_pos(p)
|
||||||
return true, "Teleporting " .. teleportee_name
|
return true, "Teleporting " .. teleportee_name
|
||||||
|
|
Loading…
Reference in New Issue