Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request minetest-mods#19 from Panquesito7/gamehub_support
Browse files Browse the repository at this point in the history
Various changes and improvements
  • Loading branch information
ChaosWormz committed Nov 23, 2019
2 parents d118710 + 723a0ad commit e84ff67
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 19 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -68,19 +68,23 @@ 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 requieres MT/MTG 5.0.0+ to run.
This mod requires MT/MTG 5.0.0+ to run.
Older versions not supported.

## Bugfixes & suggestions
Report bugs or suggest ideas by [creating an issue](https://github.com/ChaosWormz/teleport-request/issues/new).
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)
Expand All @@ -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)
- 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.
Expand All @@ -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`.

## 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
Expand All @@ -118,15 +120,15 @@ 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).
- Create a better sound effect for teleport and apply it to all teleport methods (not just /tpc)
- 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).
29 changes: 25 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -189,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)
Expand Down Expand Up @@ -246,6 +254,7 @@ function tp.tphr_send(sender, receiver)
end
return
end

if receiver == "" then
minetest.chat_send_player(sender, S("Usage: /tphr <Player name>"))
if minetest.get_modpath("chat2") then
Expand All @@ -261,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.
Expand Down
4 changes: 4 additions & 0 deletions locale/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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."
Expand Down
4 changes: 4 additions & 0 deletions locale/template.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit e84ff67

Please sign in to comment.