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.