From 1000ebe87be296e00fd084fbc90d61c2d2cfb52a Mon Sep 17 00:00:00 2001 From: Aleksandr Avdeev Date: Tue, 15 Oct 2024 14:38:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=B0=D1=8F=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=87=D0=B0=D1=8F=20=D0=B2=D0=B5=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D1=8F=20=20=D0=BC=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++ locale/getto.ru.tr | 6 +++++ mod.conf | 3 +++ 3 files changed, 66 insertions(+) create mode 100644 init.lua create mode 100644 locale/getto.ru.tr create mode 100644 mod.conf diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..01cca5f --- /dev/null +++ b/init.lua @@ -0,0 +1,57 @@ + +local S = minetest.get_translator("getto") + +getto_list = {"xek130"} + +getto = {} + +getto.centrepos = { + x = 21888, + y = 17, + z = 25025 +} + +getto.min_pos_x = 21689 +getto.max_pos_x = 22032 +getto.min_pos_z = 24725 +getto.max_pos_z = 25199 + +local timer = 0 +local timer_alert = 0 + +local interval_alert = 1 +local overall_time_alert = 10 + +minetest.register_globalstep(function(dtime) + + if timer > os.time() then + return + end + timer = os.time() + interval_alert + + for i = 1, #getto_list do + local player = minetest.env:get_player_by_name(getto_list[i]) + + if player then + local pos = player:get_pos() + + if (pos.x > getto.max_pos_x or pos.x < getto.min_pos_x or pos.z > getto.max_pos_z or pos.z < getto.min_pos_z) then + msg = minetest.colorize("red", S("Return to the Ghetto territory!") .. S(" Time until return: ") .. overall_time_alert - timer_alert .. " c") + minetest.chat_send_player(getto_list[i], msg) + timer_alert = timer_alert + interval_alert + if timer_alert > overall_time_alert then + msg2 = minetest.colorize("red", S("You have been returned to the Ghetto!")) + minetest.chat_send_player(getto_list[i], msg2) + player:set_pos(getto.centrepos) + timer_alert = 0 + end + else + if timer_alert ~= 0 then + msg3 = minetest.colorize("green", S("Thank you for coming back)")) + minetest.chat_send_player(getto_list[i], msg3) + timer_alert = 0 + end + end + end + end +end) \ No newline at end of file diff --git a/locale/getto.ru.tr b/locale/getto.ru.tr new file mode 100644 index 0000000..a6dd9b8 --- /dev/null +++ b/locale/getto.ru.tr @@ -0,0 +1,6 @@ +# textdomain: getto + +Return to the Ghetto territory!=Вернитесь на территорию Гетто! + Time until return: = Время до возращения: +You have been returned to the Ghetto!=Вы были возвращены в Гетто! +Thank you for coming back)=Спасибо, что вернулись добровольно) \ No newline at end of file diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..09e4f84 --- /dev/null +++ b/mod.conf @@ -0,0 +1,3 @@ +name = getto +description = Add getto +depends = default \ No newline at end of file