summaryrefslogtreecommitdiff
path: root/teleport_request
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
commita5eef1c5de77fa7770877802e66c3e1c53f9a0da (patch)
tree0f36e64a58e5f5bb7d95be6ae692f58f2ebfe483 /teleport_request
parentdda854cf06f90a04a03844e19c4d4ad220e38fe4 (diff)
downloaddreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.gz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.bz2
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.xz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.zip
update castles, areas, homedecor, plantlife,
gloopblocks, hotbar, inspector, maptools, mesecons, moreblocks, moreores, technic, teleport_request, and worldedit switched to caverealms_lite (with minor fixes by me) switched to CWz's fork of player_textures The homedecor update brings in the big split, and will require you to re-enable all modpack components in order to avoid loss of content.
Diffstat (limited to 'teleport_request')
-rw-r--r--teleport_request/init.lua32
1 files changed, 18 insertions, 14 deletions
diff --git a/teleport_request/init.lua b/teleport_request/init.lua
index cf843b0..f51c555 100644
--- a/teleport_request/init.lua
+++ b/teleport_request/init.lua
@@ -10,6 +10,11 @@ local version = "1.5"
local tpr_list = {}
local tphr_list = {}
+local map_size = 30912
+local function can_teleport(to)
+ return to.x < map_size and to.x > -map_size and to.y < map_size and to.y > -map_size and to.z < map_size and to.z > -map_size
+end
+
minetest.register_privilege("tp_admin", {
description = "Admin overrides for tps_teleport.",
give_to_singleplayer=false
@@ -121,14 +126,14 @@ local function tpc_send(player,coordinates)
minetest.chat_send_player(player, "Usage: /tpc <x,y,z>")
return nil
end
-
- if posx > 32765 or posx < -32765 or posy > 32765 or posy < -32765 or posz > 32765 or posz < -32765 then
- minetest.chat_send_player(player, "Error: Invalid coordinates.")
- return nil
- end
local target_coords={x=posx, y=posy, z=posz}
+ if can_teleport(target_coords) == false then
+ minetest.chat_send_player("You cannot teleport to a location outside the map!")
+ return nil
+ end
+
-- If the area is protected, reject the user's request to teleport to these coordinates
-- In future release we'll actually query the player who owns the area, if they're online, and ask for their permission.
-- Admin user (priv "tp_admin") overrides all protection
@@ -235,22 +240,21 @@ local function tpj(player,param)
local target_coords = minetest.get_player_by_name(player):getpos()
if args[1] == "x" then
target_coords["x"] = target_coords["x"] + tonumber(args[2])
- pname:setpos(find_free_position_near(target_coords))
- minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
- --parti2(target_coords)
elseif args[1] == "y" then
target_coords["y"] = target_coords["y"] + tonumber(args[2])
- pname:setpos(find_free_position_near(target_coords))
- minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
- --parti2(target_coords)
elseif args[1] == "z" then
target_coords["z"] = target_coords["z"] + tonumber(args[2])
- pname:setpos(find_free_position_near(target_coords))
- minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
- --parti2(target_coords)
else
minetest.chat_send_player(player,"Not a valid axis. Valid options are X, Y or Z.")
+ return
+ end
+ if can_teleport(target_coords) == false then
+ minetest.chat_send_player(player, "You cannot teleport to a location outside the map!")
+ return
end
+ pname:setpos(find_free_position_near(target_coords))
+ minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10})
+ --parti2(target_coords)
end
-- Evade