From 97502163f4ef5807722003b372725c3b9268872e Mon Sep 17 00:00:00 2001 From: Robbie Ferguson Date: Tue, 17 May 2016 10:49:11 -0400 Subject: [PATCH 1/3] Add Traxie21, Github link to Robbie --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 704f5bc..d23c84a 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,10 @@ Accept a user's request to teleport to you or teleport you to them. Deny a user's request to teleport to youor teleport you to them. ##Contributors: -- [RobbieF](https://minetest.tv) +- [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: From f64bb6ea16c190a77a3a5ee7a2c429f3c6afff11 Mon Sep 17 00:00:00 2001 From: Robbie Ferguson Date: Tue, 17 May 2016 13:04:01 -0400 Subject: [PATCH 2/3] Add feature request from ChaosWormz --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d23c84a..2458f3e 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,4 @@ Deny a user's request to teleport to youor teleport you to them. - 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. From 5f12f7b6d6f95ffa28a3b772d783cd355bebc785 Mon Sep 17 00:00:00 2001 From: Robbie Ferguson Date: Tue, 17 May 2016 13:15:48 -0400 Subject: [PATCH 3/3] /tpc now requires tp_tpc priv As requested by ChaosWormz --- init.lua | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 23b7b0b..e57b592 100644 --- a/init.lua +++ b/init.lua @@ -10,7 +10,14 @@ 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_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 = { @@ -131,18 +138,23 @@ local function tpc_send(player,coordinates) minetest.sound_play("whoosh", {pos = target_coords, gain = 0.5, max_hear_distance = 10}) parti2(target_coords) else - 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 + 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 - 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) end end