From 50619558ce4840b25861ef58268e5fa975891b57 Mon Sep 17 00:00:00 2001 From: Panquesito7 Date: Fri, 22 Nov 2019 12:56:08 -0600 Subject: [PATCH 1/2] Various readability improvements --- README.md | 29 +++++++++++++++-------------- init.lua | 5 +---- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2042c6d..4f1b2eb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A mod that allows players to send a teleport request. **(See "How to use" below for more information.)** -## Privileges: +## Privileges Each command needs a privilege. These are the following privileges: - **tp** is requiered in order to use all commands. - **tp_tpc** is requiered in order to use `/tpc` @@ -12,7 +12,7 @@ Each command needs a privilege. These are the following privileges: **tp_admin** overrides everything: e.g. you can teleport to players even when they haven't decided to accept, or not. You can also teleport him/her to you (this happens only when `enable_immediate_teleport` is enabled on `config.lua`). Players can also teleport to coordinates, however, if the area is protected, the teleport will be denied. -## How to use: +## How to use Each command does a function. "**Example Usage**" is an example of how to use the command. Note there must be 2 players in order to make the commands to work: a player must send a request to another player (**see https://wiki.minetest.net/Server or see https://wiki.minetest.net/Setting_up_a_server for more information**). There are two methods of sending a request: @@ -27,20 +27,20 @@ These are the following commands available in-game: - **Description:** Requests permission to teleport to another player, where [playername] is their exact name. - **Required Privileges:** `interact, tp` - **Example Usage:** */tpr RobbieF* - requests permission from RobbieF to teleport to them. -- **Notes:** Usernames are case-sensitive. If you have "tp_admin" privilege, you will immediately teleport to the specificed player (does not apply if `enable_immediate_teleport` setting is disabled, enabled by default). +- **Notes:** Usernames are case-sensitive. If you have the `tp_admin` privilege, you will immediately teleport to the specificed player (does not apply if `enable_immediate_teleport` setting is disabled, enabled by default). ``` /tphr [playername] ``` - **Name:** Teleport Here Request - **Description:** Request permission to teleport another player to you. - **Required Privileges:** `interact, tp` - **Example Usage:** /tphr RobbieF - requests RobbieF to teleport to you. -- **Notes:** Usernames are case-sensitive. If you have "tp_admin" privilege, RobbieF will teleport to you immediately (does not apply if `enable_immediate_teleport` setting is disabled, enabled by default). +- **Notes:** Usernames are case-sensitive. If you have the `tp_admin` privilege, RobbieF will teleport to you immediately (does not apply if `enable_immediate_teleport` setting is disabled, enabled by default). ``` /tpc [x,y,z] ``` - **Name:** Teleport to Coordinates - **Description:** Teleport to coordinates. - **Required Privileges:** `interact, tp_tpc, tp` -- **Notes:** Honors area protection: if the area is protected, it must be owned by you in order to teleport to it, or you must have "areas" privilege in order to teleport to those coordinates (this works only when [areas](https://github.com/minetest-mods/areas) is installed). +- **Notes:** Honors area protection. If the area is protected, it must be owned by you in order to teleport to it, or you must have the `areas` privilege in order to teleport to those coordinates. ``` /tpj [axis] [distance] ``` - **Name:** Teleport Jump @@ -70,7 +70,7 @@ However, optional dependencies are: - [chat2](https://github.com/minetest-mods/chat2) ## Requirements -This mod requieres MT/MTG 5.0.0+ to run. +This mod requires MT/MTG 5.0.0+ to run. Older versions not supported. ## Bugfixes & suggestions @@ -78,9 +78,12 @@ Report bugs or suggest ideas by [creating an issue](https://github.com/ChaosWorm If you know how to fix an issue, or want something to be added, consider opening a [pull request](https://github.com/ChaosWormz/teleport-request/compare). ## License -[LGPL-2.1](https://github.com/ChaosWormz/teleport-request/blob/master/LICENSE.md) for everything. +[LGPLv2.1+](https://github.com/ChaosWormz/teleport-request/blob/master/LICENSE.md) for everything. + +## Contributors + +List of contributors (in no particular order): -## Contributors: - [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV) - [DonBatman](https://github.com/donbatman) - [NathanS21](http://nathansalapat.com/) | [GitHub](https://github.com/NathanSalapat) @@ -92,8 +95,6 @@ If you know how to fix an issue, or want something to be added, consider opening - [Billy-S](https://github.com/Billy-S) - Traxie21, the original creator of this mod (however, he/she does not have a GitHub account anymore). -All those who contributed to the original mod (please see `init.lua`). - ## Configuring the mod Open your `minetest.conf` located in your Minetest directory. Set the values of the settings you'd like to. @@ -109,7 +110,7 @@ You can also go to your Minetest, Settings tab, All settings, Mods, and you'll f Or another way to do it, is changing the values in `settingtypes.txt`. ## Installation -- Unzip the archive, rename the folder to tpr and +- Unzip the archive, rename the folder to `tpr` and place it in ..minetest/mods/ - GNU/Linux: If you use a system-wide installation place @@ -118,10 +119,10 @@ place it in ..minetest/mods/ - If you only want this to be used in a single world, place the folder in ..worldmods/ in your world directory. -For further information or help, see: +For further information or help, see: https://wiki.minetest.net/Installing_Mods -## TODO: +## TODO - 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. - 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). @@ -129,4 +130,4 @@ https://wiki.minetest.net/Installing_Mods - Rewrite to place all chat commands into one single command much like how /teleport works. - Make evade respect land: no teleporting inside land, but instead make sure player is standing on surface or in water. -If you think something else should be added to this list, [submit an issue](https://github.com/ChaosWormz/teleport-request/issues/new). +If you think something else should be added to this list, [submit an issue](https://github.com/ChaosWormz/teleport-request/issues/new). \ No newline at end of file diff --git a/init.lua b/init.lua index 0fbd7af..06ac799 100644 --- a/init.lua +++ b/init.lua @@ -22,10 +22,7 @@ Originally made by Traxie21 and released with the WTFPL license. Forum link: https://forum.minetest.net/viewtopic.php?id=4457 Updates by Zeno, Panquesito7 and ChaosWormz. -License: LGPL-2.1 for everything. - -Optional dependencies: areas, intllib -New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/ +License: LGPLv2.1+ for everything. --]] tp = {} From 723a0ad42dc288562173c2b50af486392dd7b070 Mon Sep 17 00:00:00 2001 From: Panquesito7 Date: Fri, 22 Nov 2019 13:50:10 -0600 Subject: [PATCH 2/2] Add support for gamehub (UNTESTED) By @shivajiva101. --- README.md | 1 + init.lua | 24 ++++++++++++++++++++++++ locale/es.po | 4 ++++ locale/template.pot | 4 ++++ mod.conf | 2 +- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f1b2eb..c78af8a 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ However, optional dependencies are: - [intllib](https://github.com/minetest-mods/intllib) - [beerchat](https://github.com/pandorabox-io/beerchat) - [chat2](https://github.com/minetest-mods/chat2) +- [gamehub](https://github.com/shivajiva101/minetest-gamehub) ## Requirements This mod requires MT/MTG 5.0.0+ to run. diff --git a/init.lua b/init.lua index 06ac799..e18a061 100644 --- a/init.lua +++ b/init.lua @@ -186,6 +186,17 @@ function tp.tpr_send(sender, receiver) end return end + + if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED) + if gamehub.players[receiver] then + minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!")) + if minetest.get_modpath("chat2") then + chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF) + end + return + end + end + if minetest.get_modpath("chat2") then chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting to teleport to you. /tpy to accept", sender), 0xFFFFFF) chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF) @@ -243,6 +254,7 @@ function tp.tphr_send(sender, receiver) end return end + if receiver == "" then minetest.chat_send_player(sender, S("Usage: /tphr ")) if minetest.get_modpath("chat2") then @@ -258,10 +270,22 @@ function tp.tphr_send(sender, receiver) end return end + + if minetest.get_modpath("gamehub") then -- Compatibility with gamehub (UNTESTED) + if gamehub.players[receiver] then + minetest.chat_send_player(sender, S("Teleport request denied, player is in the gamehub!")) + if minetest.get_modpath("chat2") then + chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request denied, player is in the gamehub!"), 0xFFFFFF) + end + return + end + end + if minetest.get_modpath("chat2") then chat2.send_message(minetest.get_player_by_name(receiver), S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny", sender), 0xFFFFFF) chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF) end + minetest.chat_send_player(receiver, S("@1 is requesting that you teleport to them. /tpy to accept; /tpn to deny", sender)) minetest.chat_send_player(sender, S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay)) -- Write name values to list and clear old values. diff --git a/locale/es.po b/locale/es.po index af580f8..f6a793b 100644 --- a/locale/es.po +++ b/locale/es.po @@ -40,6 +40,10 @@ msgstr "Uso: /tpr " msgid "There is no player by that name. Keep in mind this is case-sensitive, and the player must be online" msgstr "No hay jugador con ese nombre. Tenga en cuenta que esto es caso-sensitivo, y el jugador debe de estar én linea." +#: init.lua +msgid "Teleport request denied, player is in the gamehub!" +msgstr "Solicitud denegada, ¡el jugador esta en el centro de juegos!" + #: init.lua msgid "You are teleporting to @1." msgstr "Te estas teletransportando a @1." diff --git a/locale/template.pot b/locale/template.pot index 71dd5df..9258c3e 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -40,6 +40,10 @@ msgstr "" msgid "There is no player by that name. Keep in mind this is case sensitive, and the player must be online" msgstr "" +#: init.lua +msgid "Teleport request denied, player is in the gamehub!" +msgstr "" + #: init.lua msgid "You are teleporting to @1." msgstr "" diff --git a/mod.conf b/mod.conf index 0ed6a1d..b03155b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = tpr -optional_depends = areas, intllib, beerchat, chat2 +optional_depends = areas, intllib, beerchat, chat2, gamehub description = Allows players to send a request to other players to teleport to them, and do much more.