forked from Mirrorlandia_minetest/minetest
Avoid teleporting player if /teleport coords are out-of-range
This commit is contained in:
parent
dc35091aff
commit
7baddd1735
@ -352,11 +352,17 @@ core.register_chatcommand("teleport", {
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
if p.x and p.y and p.z then
|
||||
local lm = tonumber(minetest.setting_get("map_generation_limit") or 31000)
|
||||
if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
|
||||
return false, "Cannot teleport out of map bounds!"
|
||||
end
|
||||
teleportee = core.get_player_by_name(name)
|
||||
if teleportee and p.x and p.y and p.z then
|
||||
if teleportee then
|
||||
teleportee:setpos(p)
|
||||
return true, "Teleporting to "..core.pos_to_string(p)
|
||||
end
|
||||
end
|
||||
|
||||
local teleportee = nil
|
||||
local p = nil
|
||||
|
Loading…
Reference in New Issue
Block a user