Merge pull request #19 from Panquesito7/gamehub_support

Various changes and improvements
This commit is contained in:
ChaosWormz 2019-11-23 10:17:24 +02:00 committed by GitHub
commit e84ff67522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 19 deletions

@ -2,7 +2,7 @@
A mod that allows players to send a teleport request. A mod that allows players to send a teleport request.
**(See "How to use" below for more information.)** **(See "How to use" below for more information.)**
## Privileges: ## Privileges
Each command needs a privilege. These are the following privileges: Each command needs a privilege. These are the following privileges:
- **tp** is requiered in order to use all commands. - **tp** is requiered in order to use all commands.
- **tp_tpc** is requiered in order to use `/tpc` - **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`). **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. 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. 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**). 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: 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. - **Description:** Requests permission to teleport to another player, where [playername] is their exact name.
- **Required Privileges:** `interact, tp` - **Required Privileges:** `interact, tp`
- **Example Usage:** */tpr RobbieF* - requests permission from RobbieF to teleport to them. - **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] ``` ``` /tphr [playername] ```
- **Name:** Teleport Here Request - **Name:** Teleport Here Request
- **Description:** Request permission to teleport another player to you. - **Description:** Request permission to teleport another player to you.
- **Required Privileges:** `interact, tp` - **Required Privileges:** `interact, tp`
- **Example Usage:** /tphr RobbieF - requests RobbieF to teleport to you. - **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] ``` ``` /tpc [x,y,z] ```
- **Name:** Teleport to Coordinates - **Name:** Teleport to Coordinates
- **Description:** Teleport to coordinates. - **Description:** Teleport to coordinates.
- **Required Privileges:** `interact, tp_tpc, tp` - **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] ``` ``` /tpj [axis] [distance] ```
- **Name:** Teleport Jump - **Name:** Teleport Jump
@ -68,9 +68,10 @@ However, optional dependencies are:
- [intllib](https://github.com/minetest-mods/intllib) - [intllib](https://github.com/minetest-mods/intllib)
- [beerchat](https://github.com/pandorabox-io/beerchat) - [beerchat](https://github.com/pandorabox-io/beerchat)
- [chat2](https://github.com/minetest-mods/chat2) - [chat2](https://github.com/minetest-mods/chat2)
- [gamehub](https://github.com/shivajiva101/minetest-gamehub)
## Requirements ## 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. Older versions not supported.
## Bugfixes & suggestions ## Bugfixes & suggestions
@ -78,9 +79,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). 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 ## 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) - [RobbieF](https://minetest.tv) | [GitHub](https://github.com/Cat5TV)
- [DonBatman](https://github.com/donbatman) - [DonBatman](https://github.com/donbatman)
- [NathanS21](http://nathansalapat.com/) | [GitHub](https://github.com/NathanSalapat) - [NathanS21](http://nathansalapat.com/) | [GitHub](https://github.com/NathanSalapat)
@ -92,8 +96,6 @@ If you know how to fix an issue, or want something to be added, consider opening
- [Billy-S](https://github.com/Billy-S) - [Billy-S](https://github.com/Billy-S)
- Traxie21, the original creator of this mod (however, he/she does not have a GitHub account anymore). - 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 ## Configuring the mod
Open your `minetest.conf` located in your Minetest directory. Open your `minetest.conf` located in your Minetest directory.
Set the values of the settings you'd like to. Set the values of the settings you'd like to.
@ -109,7 +111,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`. Or another way to do it, is changing the values in `settingtypes.txt`.
## Installation ## Installation
- Unzip the archive, rename the folder to tpr and - Unzip the archive, rename the folder to `tpr` and
place it in ..minetest/mods/ place it in ..minetest/mods/
- GNU/Linux: If you use a system-wide installation place - GNU/Linux: If you use a system-wide installation place
@ -118,10 +120,10 @@ place it in ..minetest/mods/
- If you only want this to be used in a single world, place - If you only want this to be used in a single world, place
the folder in ..worldmods/ in your world directory. 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 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. - 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. - 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). - 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 +131,4 @@ https://wiki.minetest.net/Installing_Mods
- Rewrite to place all chat commands into one single command much like how /teleport works. - 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. - 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).

@ -22,10 +22,7 @@ Originally made by Traxie21 and released with the WTFPL license.
Forum link: https://forum.minetest.net/viewtopic.php?id=4457 Forum link: https://forum.minetest.net/viewtopic.php?id=4457
Updates by Zeno, Panquesito7 and ChaosWormz. Updates by Zeno, Panquesito7 and ChaosWormz.
License: LGPL-2.1 for everything. License: LGPLv2.1+ for everything.
Optional dependencies: areas, intllib
New release by RobbieF under new mod: tps_teleport - http://blog.minetest.tv/teleport-request/
--]] --]]
tp = {} tp = {}
@ -189,6 +186,17 @@ function tp.tpr_send(sender, receiver)
end end
return return
end 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 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(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) chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF)
@ -246,6 +254,7 @@ function tp.tphr_send(sender, receiver)
end end
return return
end end
if receiver == "" then if receiver == "" then
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>")) minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
if minetest.get_modpath("chat2") then if minetest.get_modpath("chat2") then
@ -261,10 +270,22 @@ function tp.tphr_send(sender, receiver)
end end
return return
end 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 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(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) chat2.send_message(minetest.get_player_by_name(sender), S("Teleport request sent! It will timeout in @1 seconds", tp.timeout_delay), 0xFFFFFF)
end 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(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)) 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. -- Write name values to list and clear old values.

@ -40,6 +40,10 @@ msgstr "Uso: /tpr <jugador>"
msgid "There is no player by that name. Keep in mind this is case-sensitive, and the player must be online" 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." 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 #: init.lua
msgid "You are teleporting to @1." msgid "You are teleporting to @1."
msgstr "Te estas teletransportando a @1." msgstr "Te estas teletransportando a @1."

@ -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" msgid "There is no player by that name. Keep in mind this is case sensitive, and the player must be online"
msgstr "" msgstr ""
#: init.lua
msgid "Teleport request denied, player is in the gamehub!"
msgstr ""
#: init.lua #: init.lua
msgid "You are teleporting to @1." msgid "You are teleporting to @1."
msgstr "" msgstr ""

@ -1,3 +1,3 @@
name = tpr 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. description = Allows players to send a request to other players to teleport to them, and do much more.