diff --git a/mods/README.md b/mods/README.md index 15d2aa9..2691172 100644 --- a/mods/README.md +++ b/mods/README.md @@ -18,7 +18,6 @@ For information check [../README.md](../README.md) | creative | https://codeberg.org/minenux/minetest-mod-creative | https://codeberg.org/minenux/minetest-mod-creative/commit/ca09e773701f834fec7de18bf13598b3323778db | [creative/README.md](creative/README.md) | | default | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | | player_api | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | -| set_home | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | | env_sounds | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | | game_commands | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | | spawn | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | @@ -34,6 +33,7 @@ For information check [../README.md](../README.md) | sfinv | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | | stairs | https://codeberg.org/minenux/minetest-mod-stairs | https://codeberg.org/minenux/minetest-mod-stairs/commit/c3a5af6c452daca599d226df694df1b75f15c110 | [stairs/README.md](stairs/README.md) | | screwdriver | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | +| sethome | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/8e59006dc81ebe6785380158e57ba126cb3a4163 | | | tnt | https://codeberg.org/minenux/minetest-mod-tnt | https://codeberg.org/minenux/minetest-mod-tnt/commit/8195861f905a90b53cd52348deb34df41a053027 | [tnt/README.md](tnt/README.md) | | toolranks | https://codeberg.org/minenux/minetest-mod-toolranks | https://codeberg.org/minenux/minetest-mod-toolranks/commit/5c9553e5ac6cc7ae375033b76ef7771a6935c771 | [toolranks/README.md](toolranks/README.md) | | vessels | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/eb64ff94f82d726e4a55b20fa7ce30e4a7470cc5 | | diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua index bad7806..ac48e6d 100644 --- a/mods/sethome/init.lua +++ b/mods/sethome/init.lua @@ -3,11 +3,34 @@ sethome = {} -- Load support for MT game translation. -local S = minetest.get_translator("sethome") +local S local homes_file = minetest.get_worldpath() .. "/homes" local homepos = {} +local is_50 = minetest.has_feature("object_use_texture_alpha") or false + +if minetest.get_translator ~= nil then + S = minetest.get_translator("sethome") -- 5.x translation function +else + if minetest.get_modpath("intllib") then + dofile(minetest.get_modpath("intllib") .. "/init.lua") + if intllib.make_gettext_pair then + gettext, ngettext = intllib.make_gettext_pair() -- new gettext method + else + gettext = intllib.Getter() -- old text file method + end + S = gettext + else -- boilerplate function + S = function(str, ...) + local args = {...} + return str:gsub("@%d+", function(match) + return args[tonumber(match:sub(2))] + end) + end + end +end + local function loadhomes() local input = io.open(homes_file, "r") @@ -29,9 +52,17 @@ sethome.set = function(name, pos) if not player or not pos then return false end - player:set_attribute("sethome:home", minetest.pos_to_string(pos)) + if is_50 then + local player_meta = player:get_meta() + player_meta:set_string("sethome:home", minetest.pos_to_string(pos)) + else + player:set_attribute("sethome:home", minetest.pos_to_string(pos)) + end -- remove `name` from the old storage file + if not homepos[name] then + return true + end local data = {} local output = io.open(homes_file, "w") if output then @@ -48,7 +79,17 @@ end sethome.get = function(name) local player = minetest.get_player_by_name(name) - local pos = minetest.string_to_pos(player:get_attribute("sethome:home")) + if not player then + return false, S("This command can only be executed in-game!") + end + local player_meta + local pos + if is_50 then + player_meta = player:get_meta() + pos = minetest.string_to_pos(player_meta:get_string("sethome:home")) + else + pos = minetest.string_to_pos(player:get_attribute("sethome:home")) + end if pos then return pos end @@ -81,6 +122,10 @@ minetest.register_chatcommand("home", { description = S("Teleport you to your home point"), privs = {home = true}, func = function(name) + local player = minetest.get_player_by_name(name) + if not player then + return false, S("This command can only be executed in-game!") + end if sethome.go(name) then return true, S("Teleported to home!") end diff --git a/mods/sethome/locale/sethome.de.tr b/mods/sethome/locale/sethome.de.tr index 46279dd..c59b26e 100644 --- a/mods/sethome/locale/sethome.de.tr +++ b/mods/sethome/locale/sethome.de.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!=Dieser Befehl kann nur im Spiel ausgeführt werden! Can use /sethome and /home=Kann /sethome und /home benutzen Teleport you to your home point=Teleportieren Sie sich zu Ihrem Zuhause-Punkt Teleported to home!=Nach Hause teleportiert! diff --git a/mods/sethome/locale/sethome.eo.tr b/mods/sethome/locale/sethome.eo.tr new file mode 100644 index 0000000..86ef814 --- /dev/null +++ b/mods/sethome/locale/sethome.eo.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Povas uzi /sethome kaj /home +Teleport you to your home point=Teletransporti vin al via hejmo +Teleported to home!=Teletransportita al hejmo! +Set a home using /sethome=Fiksi hejmon per /sethome +Set your home point=Fiksi vian hejman punkton +Home set!=Fiksita hejmo! +Player not found!=Ludanto ne troveblas! diff --git a/mods/sethome/locale/sethome.es.tr b/mods/sethome/locale/sethome.es.tr index 7c04ee3..661bc62 100644 --- a/mods/sethome/locale/sethome.es.tr +++ b/mods/sethome/locale/sethome.es.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!= Can use /sethome and /home=Puedes usar /sethome y /home Teleport you to your home point=Teletranspórtate a tu hogar Teleported to home!=¡Teletransportado a tu hogar! diff --git a/mods/sethome/locale/sethome.fr.tr b/mods/sethome/locale/sethome.fr.tr index 852621d..01345e0 100644 --- a/mods/sethome/locale/sethome.fr.tr +++ b/mods/sethome/locale/sethome.fr.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!=Cette commande peut seulement être exécutée en jeu ! Can use /sethome and /home=Peut utiliser /sethome et /home Teleport you to your home point=Vous téléporter à votre domicile Teleported to home!=Téléporté à votre domicile ! diff --git a/mods/sethome/locale/sethome.id.tr b/mods/sethome/locale/sethome.id.tr new file mode 100644 index 0000000..6193446 --- /dev/null +++ b/mods/sethome/locale/sethome.id.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Boleh pakai /sethome dan /home +Teleport you to your home point=Teleportasi ke rumah Anda +Teleported to home!=Teleportasi ke rumah! +Set a home using /sethome=Atur letak rumah dengan /sethome +Set your home point=Atur letak rumah +Home set!=Letak rumah diatur! +Player not found!=Pemain tidak ditemukan! diff --git a/mods/sethome/locale/sethome.it.tr b/mods/sethome/locale/sethome.it.tr index bbf86b8..4f1d757 100644 --- a/mods/sethome/locale/sethome.it.tr +++ b/mods/sethome/locale/sethome.it.tr @@ -1,8 +1,9 @@ -# textdomain: sethome -Can use /sethome and /home=Può usare /sethome e /home -Teleport you to your home point=Ti teletrasporta al tuo punto di domicilio -Teleported to home!=Teletrasportato a casa! -Set a home using /sethome=Imposta un domicilio usando /sethome -Set your home point=Imposta il tuo punto di domicilio -Home set!=Domicilio impostato! -Player not found!=Giocatore non trovato! \ No newline at end of file +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Può usare /sethome e /home +Teleport you to your home point=Ti teletrasporta al tuo punto di domicilio +Teleported to home!=Teletrasportato a casa! +Set a home using /sethome=Imposta un domicilio usando /sethome +Set your home point=Imposta il tuo punto di domicilio +Home set!=Domicilio impostato! +Player not found!=Giocatore non trovato! diff --git a/mods/sethome/locale/sethome.ja.tr b/mods/sethome/locale/sethome.ja.tr new file mode 100644 index 0000000..e652387 --- /dev/null +++ b/mods/sethome/locale/sethome.ja.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=/sethomeと/homeが使えます +Teleport you to your home point=ホーム地点にテレポートします +Teleported to home!=ホームにテレポート! +Set a home using /sethome=/sethomeを使ってホームを設定します +Set your home point=ホーム地点を設定します +Home set!=ホーム地点をセット! +Player not found!=プレーヤーが見つかりません! diff --git a/mods/sethome/locale/sethome.jbo.tr b/mods/sethome/locale/sethome.jbo.tr new file mode 100644 index 0000000..2fe7bf0 --- /dev/null +++ b/mods/sethome/locale/sethome.jbo.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=kakne lo nu pilno lo me zoi gy./sethome.gy. ku .e lo me zoi gy./home.gy. +Teleport you to your home point=sukmu'u lo do zdani mokca +Teleported to home!=puba'o sukmu'u lo zdani +Set a home using /sethome=ko tcimi'e fi lo zdani sepi'o lo me zoi gy./sethome.gy. +Set your home point=tcimi'e fi lo do zdani mokca +Home set!=puba'o tcimi'e fi lo zdani +Player not found!=lo kelci na te facki diff --git a/mods/sethome/locale/sethome.ms.tr b/mods/sethome/locale/sethome.ms.tr index 7e9ec76..26a771c 100644 --- a/mods/sethome/locale/sethome.ms.tr +++ b/mods/sethome/locale/sethome.ms.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!= Can use /sethome and /home=Boleh guna /sethome dan /home Teleport you to your home point=Teleportasikan anda ke titik rumah anda Teleported to home!=Diteleportasikan ke rumah! diff --git a/mods/sethome/locale/sethome.pl.tr b/mods/sethome/locale/sethome.pl.tr new file mode 100644 index 0000000..b45cb46 --- /dev/null +++ b/mods/sethome/locale/sethome.pl.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Może używać /sethome i /home +Teleport you to your home point=Teleportuj się do swojego punktu domowego +Teleported to home!=Teleportowano do punktu domowego +Set a home using /sethome=Ustaw punkt domowy używając /sethome +Set your home point=Ustaw swój punkt domowy +Home set!=Punkt domowy ustawiony! +Player not found!=Gracz nie odnaleziony! diff --git a/mods/sethome/locale/sethome.pt_BR.tr b/mods/sethome/locale/sethome.pt_BR.tr new file mode 100644 index 0000000..6abd416 --- /dev/null +++ b/mods/sethome/locale/sethome.pt_BR.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Pode usar /sethome e /home +Teleport you to your home point=Teletransportá-lo para seu ponto de origem +Teleported to home!=Teletransportado para o ponto de origem! +Set a home using /sethome=Defina um ponto de origem usando /sethome +Set your home point=Define seu ponto de origem +Home set!=Ponto de origem definido! +Player not found!=Jogador não encontrado! diff --git a/mods/sethome/locale/sethome.ru.tr b/mods/sethome/locale/sethome.ru.tr index 6738824..75b2d49 100644 --- a/mods/sethome/locale/sethome.ru.tr +++ b/mods/sethome/locale/sethome.ru.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!=Эта команда может быть использована только в игре! Can use /sethome and /home=Возможность использовать /sethome и /home Teleport you to your home point=Вы телепортируетесь в свою домашнюю точку Teleported to home!=Вы телепортировались домой! diff --git a/mods/sethome/locale/sethome.sk.tr b/mods/sethome/locale/sethome.sk.tr new file mode 100644 index 0000000..c0e6cee --- /dev/null +++ b/mods/sethome/locale/sethome.sk.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Môžeš použivať /sethome a /home +Teleport you to your home point=Teleportuj sa domov +Teleported to home!=Teleportovaný domov! +Set a home using /sethome=Nastav si domov použitím /sethome +Set your home point=Nastaviť si domov +Home set!=Domov nastavený! +Player not found!=Hráč nenájdený! diff --git a/mods/sethome/locale/sethome.sv.tr b/mods/sethome/locale/sethome.sv.tr new file mode 100644 index 0000000..4e100b8 --- /dev/null +++ b/mods/sethome/locale/sethome.sv.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Kan använda /sethome och /home +Teleport you to your home point=Teleportera dig till din hempunkt +Teleported to home!=Teleporterad hem! +Set a home using /sethome=Ställ in ett hem med /sethome +Set your home point=Ställ in din hempunkt +Home set!=Hem inställt! +Player not found!=Spelare finns inte! diff --git a/mods/sethome/locale/sethome.uk.tr b/mods/sethome/locale/sethome.uk.tr new file mode 100644 index 0000000..a7e310a --- /dev/null +++ b/mods/sethome/locale/sethome.uk.tr @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home=Можливість використання /sethome та /home +Teleport you to your home point=Ви телепортуєтесь у свою домашню точку +Teleported to home!=Ви телепортувались додому! +Set a home using /sethome=Встановіть домашню точку, використовуючи /sethome +Set your home point=Встановіть домашню точку +Home set!=Домашня точка встановлена! +Player not found!=Гравець не визначений! diff --git a/mods/sethome/locale/sethome.zh_CN.tr b/mods/sethome/locale/sethome.zh_CN.tr index 9e3780a..6e05576 100644 --- a/mods/sethome/locale/sethome.zh_CN.tr +++ b/mods/sethome/locale/sethome.zh_CN.tr @@ -1,6 +1,7 @@ # textdomain: sethome +This command can only be executed in-game!=该指令只能在游戏内使用! Can use /sethome and /home=可以使用/sethome和/home -Teleport you to your home point=传送您到您家的地点 +Teleport you to your home point=将您传送到家 Teleported to home!=已传送到家! Set a home using /sethome=使用/sethome设定家 Set your home point=设定您家的地点 diff --git a/mods/sethome/locale/sethome.zh_TW.tr b/mods/sethome/locale/sethome.zh_TW.tr index 43e14aa..c5e455c 100644 --- a/mods/sethome/locale/sethome.zh_TW.tr +++ b/mods/sethome/locale/sethome.zh_TW.tr @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!=此指令僅能在游戲内使用! Can use /sethome and /home=可以使用/sethome和/home Teleport you to your home point=傳送您到您家的地點 Teleported to home!=已傳送到家! diff --git a/mods/sethome/locale/template.txt b/mods/sethome/locale/template.txt index d04bd50..f91c719 100644 --- a/mods/sethome/locale/template.txt +++ b/mods/sethome/locale/template.txt @@ -1,4 +1,5 @@ # textdomain: sethome +This command can only be executed in-game!= Can use /sethome and /home= Teleport you to your home point= Teleported to home!= diff --git a/mods/sethome/mod.conf b/mods/sethome/mod.conf index 0079925..87ebbe7 100644 --- a/mods/sethome/mod.conf +++ b/mods/sethome/mod.conf @@ -1,2 +1,2 @@ name = sethome -description = Minetest Game mod: sethome +description = HOME manager support in game