diff --git a/README.md b/README.md index 704f5bc..2458f3e 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: @@ -41,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. 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