summaryrefslogtreecommitdiff
path: root/teleport_request
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-05-17 20:57:26 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-05-17 20:57:26 -0400
commit94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06 (patch)
tree31039e2c0fb9744fccda027ee6e4f3152974cce6 /teleport_request
parent08597e7890192c845fba193e2456891bb85ac4cd (diff)
downloaddreambuilder_modpack-94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06.tar
dreambuilder_modpack-94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06.tar.gz
dreambuilder_modpack-94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06.tar.bz2
dreambuilder_modpack-94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06.tar.xz
dreambuilder_modpack-94f81cdae1d23aaf3214bd87a56a6b6c4cb3bf06.zip
update castle, mesecons, and tpr mods
Diffstat (limited to 'teleport_request')
-rw-r--r--teleport_request/LICENSE.md11
-rw-r--r--teleport_request/README.md47
-rw-r--r--teleport_request/depends.txt1
-rw-r--r--teleport_request/init.lua155
-rw-r--r--teleport_request/sounds/whoosh.oggbin0 -> 25717 bytes
-rw-r--r--teleport_request/textures/tps_portal_parti.pngbin0 -> 745 bytes
6 files changed, 173 insertions, 41 deletions
diff --git a/teleport_request/LICENSE.md b/teleport_request/LICENSE.md
new file mode 100644
index 0000000..24a9a3d
--- /dev/null
+++ b/teleport_request/LICENSE.md
@@ -0,0 +1,11 @@
+####DO WHAT YOU WANT TO PUBLIC LICENSE (DWYWPL)
+
+December 2nd 2015
+License Copyright (C) 2015 Michael Tomaino (PlatinumArts@gmail.com)
+[www.sandboxgamemaker.com/DWYWPL/](www.sandboxgamemaker.com/DWYWPL/)
+
+#####DO WHAT YOU WANT TO PUBLIC LICENSE
+######TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+1. You are allowed to do whatever you want to with what content is using this license.
+2. This content is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this content.
diff --git a/teleport_request/README.md b/teleport_request/README.md
index 34c8cfb..2458f3e 100644
--- a/teleport_request/README.md
+++ b/teleport_request/README.md
@@ -1,2 +1,45 @@
-This mod is released under WTFPL.
-It adds ability to teleport to other players with their permission by using the /tpr command which requires "interact" privilege and the /tphr command which requires the "interact " privilege.
+##*tps_teleport* is a mod for Minetest game servers.
+
+##Description:
+[The Pixel Shadow](https://minetest.tv/) Minetest game servers have switched from "teleport" to "teleport request" via the *tps_teleport* mod. This mod makes it so players must send a request to another player in order to teleport to them. Before they will be allowed to do so, the player must accept the request. This prevents malicious users from teleporting to players' private areas without their permission. It also enhances the overall privacy of our services since if denied teleport, a player must instead travel to the area and "use the front door" so to speak... which might be a locked iron door.
+
+##Privileges:
+- *interact* Permits use of all tps_teleport commands
+- *tp_admin* Admin priv allows admin to teleport anywhere without permission
+
+Players may also teleport to coordinates, however if the area is protected, the teleport will be denied.
+
+##Usage:
+
+``` /tpr [playername] ```
+Requests permission to teleport to another player, where [playername] is their exact name.
+
+``` /tphr [playername] ```
+Request permission to teleport another player to you.
+
+``` /tpc [x,y,z] ```
+Teleport to coordinates. Honors area protection: if the area is protected, it must be owned by you in order to teleport to it.
+
+``` /tpy ```
+Accept a user's request to teleport to you or teleport you to them.
+
+``` /tpn ```
+Deny a user's request to teleport to youor teleport you to them.
+
+##Contributors:
+- [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV)
+- [DonBatman](https://github.com/donbatman)
+- [NathanS21](http://nathansalapat.com/)
+- [Traxie21](https://github.com/Traxie21) The original creater of this mod
+- All those who contributed to the original mod (please see init.lua)
+
+##To Do:
+- Make it so if a player attempts to teleport to coordinates within a protected area owned by another player, and that player is online, the owner receives a request to allow or deny the user from teleporting to their area.
+- Add limitations to /tpc which only allow a user to teleport X number of blocks. Prevents users from teleporting to the edge of the world.
+- Make it so tp_admin priv also overrides need for player to accept /tpr or /tphr
+- Assess value in changing all tpr-based chat commands to one global command such as /tp to reduce the chance of confusion between tps_admin and the original mod (and also make it so people don't have to remember so many commands).
+- Create a better sound effect for teleport and apply it to all teleport methods (not just /tpc)
+- Creation of "evade" command /tpe which spawns the player in several random locations nearby before placing them at a final destination ~20 nodes away. For evading attack.
+- Add a handful of coordinates which can be set in config and teleported to by anyone regardless of their protection status (eg., Spawn).
+- Add a privilege which is required in order to use all commands. I haven't added such a thing since it hasn't been needed on our servers, but I imagine it would be useful on other servers who desire to grant these features only to specific players.
+- Enhance privileges: Make /tpc require a separate privilege than the /tpr or /tphr commands.
diff --git a/teleport_request/depends.txt b/teleport_request/depends.txt
new file mode 100644
index 0000000..a18cd91
--- /dev/null
+++ b/teleport_request/depends.txt
@@ -0,0 +1 @@
+areas
diff --git a/teleport_request/init.lua b/teleport_request/init.lua
index 3b4b41b..e57b592 100644
--- a/teleport_request/init.lua
+++ b/teleport_request/init.lua
@@ -1,18 +1,62 @@
--- Original code by Traxie21 and released with the WTFPL license
+-- Originally Teleport Request by Traxie21 and released with the WTFPL license
-- https://forum.minetest.net/viewtopic.php?id=4457
-
-- Updates by Zeno and ChaosWormz
+-- New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
local timeout_delay = 60
--- Set to true to register tpr_admin priv
-local regnewpriv = false
-
-local version = "1.1"
+local version = "1.3"
local tpr_list = {}
local tphr_list = {}
+minetest.register_privilege("tp_admin", {
+ description = "Admin overrides for tps_teleport.",
+ give_to_singleplayer=false
+})
+minetest.register_privilege("tp_tpc", {
+ description = "Allow player to teleport to coordinates (if permitted by area protection).",
+ give_to_singleplayer=true
+})
+
+local function find_free_position_near(pos)
+ local tries = {
+ {x=1,y=0,z=0},
+ {x=-1,y=0,z=0},
+ {x=0,y=0,z=1},
+ {x=0,y=0,z=-1},
+ }
+ for _,d in pairs(tries) do
+ local p = vector.add(pos, d)
+ if not minetest.registered_nodes[minetest.get_node(p).name].walkable then
+ return p, true
+ end
+ end
+ return pos, false
+end
+
+local function parti(pos)
+ minetest.add_particlespawner(50, 0.4,
+ {x=pos.x + 0.5, y=pos.y, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
+ {x=0, y=5, z=0}, {x=0, y=0, z=0},
+ {x=0, y=5, z=0}, {x=0, y=0, z=0},
+ 3, 5,
+ 3, 5,
+ false,
+ "tps_portal_parti.png")
+end
+
+local function parti2(pos)
+ minetest.add_particlespawner(50, 0.4,
+ {x=pos.x + 0.5, y=pos.y + 10, z=pos.z + 0.5}, {x=pos.x - 0.5, y=pos.y, z=pos.z - 0.5},
+ {x=0, y=-5, z=0}, {x=0, y=0, z=0},
+ {x=0, y=-5, z=0}, {x=0, y=0, z=0},
+ 3, 5,
+ 3, 5,
+ false,
+ "tps_portal_parti.png")
+end
+
--Teleport Request System
local function tpr_send(sender, receiver)
if receiver == "" then
@@ -62,6 +106,58 @@ local function tphr_send(sender, receiver)
end, sender)
end
+local function tpc_send(player,coordinates)
+
+ local posx,posy,posz = string.match(coordinates, "^(-?%d+),(-?%d+),(-?%d+)$")
+ local pname = minetest.get_player_by_name(player)
+
+ if posx ~= nil or posy ~= nil or posz ~= nil then
+ posx = tonumber(posx) + 0.0
+ posy = tonumber(posy) + 0.0
+ posz = tonumber(posz) + 0.0
+ end
+
+ if posx==nil or posy==nil or posz==nil or string.len(posx) > 6 or string.len(posy) > 6 or string.len(posz) > 6 then
+ 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 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
+ if minetest.check_player_privs(pname, {tp_admin=true}) then
+ minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
+ 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
+ if minetest.check_player_privs(pname, {tp_tpc=true}) then
+ local protected = minetest.is_protected(target_coords,pname)
+ if protected then
+ if not areas:canInteract(target_coords, player) then
+ local owners = areas:getNodeOwners(target_coords)
+ minetest.chat_send_player(player,("Error: %s is protected by %s."):format(minetest.pos_to_string(target_coords),table.concat(owners, ", ")))
+ return
+ end
+ end
+ minetest.chat_send_player(player, 'Teleporting to '..posx..','..posy..','..posz)
+ 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, "Error: You do not have permission to teleport to coordinates.")
+ return
+ end
+ end
+end
+
local function tpr_deny(name)
if tpr_list[name] then
minetest.chat_send_player(tpr_list[name], 'Teleport request denied.')
@@ -73,31 +169,13 @@ local function tpr_deny(name)
end
end
--- Copied from Celeron-55's /teleport command. Thanks Celeron!
-local function find_free_position_near(pos)
- local tries = {
- {x=1,y=0,z=0},
- {x=-1,y=0,z=0},
- {x=0,y=0,z=1},
- {x=0,y=0,z=-1},
- }
- for _,d in pairs(tries) do
- local p = vector.add(pos, d)
- if not minetest.registered_nodes[minetest.get_node(p).name].walkable then
- return p, true
- end
- end
- return pos, false
-end
-
-
--Teleport Accept Systems
local function tpr_accept(name, param)
--Check to prevent constant teleporting.
if not tpr_list[name]
and not tphr_list[name] then
- minetest.chat_send_player(name, "Usage: /tpy allows you to accept teleport requests sent to you by other players")
+ minetest.chat_send_player(name, "Usage: /tpy allows you to accept teleport requests sent to you by other players.")
return
end
@@ -127,21 +205,13 @@ local function tpr_accept(name, param)
minetest.chat_send_player(name2, "Request Accepted!")
minetest.chat_send_player(name, chatmsg)
-
- target:setpos(find_free_position_near(source:getpos()))
+
+ local target_coords=source:getpos()
+ target: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
---Initalize Permissions.
-
-if regnewpriv then
- minetest.register_privilege("tpr_admin", {
- description = "Permission to override teleport to other players. UNFINISHED",
- give_to_singleplayer = true
- })
-end
-
---Initalize Commands.
-
minetest.register_chatcommand("tpr", {
description = "Request teleport to another player",
params = "<playername> | leave playername empty to see help message",
@@ -156,6 +226,13 @@ minetest.register_chatcommand("tphr", {
func = tphr_send
})
+minetest.register_chatcommand("tpc", {
+ description = "Teleport to coordinates",
+ params = "<coordinates> | leave coordinates empty to see help message",
+ privs = {interact=true},
+ func = tpc_send
+})
+
minetest.register_chatcommand("tpy", {
description = "Accept teleport requests from another player",
func = tpr_accept
@@ -166,4 +243,4 @@ minetest.register_chatcommand("tpn", {
func = tpr_deny
})
-minetest.log("info", "[Teleport Request] Teleport Request v" .. version .. " Loaded.")
+minetest.log("info", "[Teleport Request] TPS Teleport v" .. version .. " Loaded.")
diff --git a/teleport_request/sounds/whoosh.ogg b/teleport_request/sounds/whoosh.ogg
new file mode 100644
index 0000000..99ea7cd
--- /dev/null
+++ b/teleport_request/sounds/whoosh.ogg
Binary files differ
diff --git a/teleport_request/textures/tps_portal_parti.png b/teleport_request/textures/tps_portal_parti.png
new file mode 100644
index 0000000..9998d75
--- /dev/null
+++ b/teleport_request/textures/tps_portal_parti.png
Binary files differ