File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -352,10 +352,16 @@ core.register_chatcommand("teleport", {
352
352
p .x = tonumber (p .x )
353
353
p .y = tonumber (p .y )
354
354
p .z = tonumber (p .z )
355
- teleportee = core .get_player_by_name (name )
356
- if teleportee and p .x and p .y and p .z then
357
- teleportee :setpos (p )
358
- return true , " Teleporting to " .. core .pos_to_string (p )
355
+ if p .x and p .y and p .z then
356
+ local lm = tonumber (minetest .setting_get (" map_generation_limit" ) or 31000 )
357
+ 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
358
+ return false , " Cannot teleport out of map bounds!"
359
+ end
360
+ teleportee = core .get_player_by_name (name )
361
+ if teleportee then
362
+ teleportee :setpos (p )
363
+ return true , " Teleporting to " .. core .pos_to_string (p )
364
+ end
359
365
end
360
366
361
367
local teleportee = nil
You can’t perform that action at this time.
0 commit comments