diff --git a/mods/README.md b/mods/README.md index e46f485..02184ec 100644 --- a/mods/README.md +++ b/mods/README.md @@ -27,6 +27,7 @@ Most of those mods have mirror at http://git.mirror.org | sfinv | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/c7cb79422ba19c696966472942db6177c934838d | | | 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/c7cb79422ba19c696966472942db6177c934838d | | +| sethome | https://codeberg.org/minenux/minetest-game-minetest | https://codeberg.org/minenux/minetest-game-minetest/commit/c7cb79422ba19c696966472942db6177c934838d | | | 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/c7cb79422ba19c696966472942db6177c934838d | | diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua index 13a33e5..ac48e6d 100644 --- a/mods/sethome/init.lua +++ b/mods/sethome/init.lua @@ -1,8 +1,36 @@ +-- sethome/init.lua sethome = {} +-- Load support for MT game translation. +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") @@ -24,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 @@ -43,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 @@ -61,37 +107,41 @@ sethome.go = function(name) local pos = sethome.get(name) local player = minetest.get_player_by_name(name) if player and pos then - player:setpos(pos) + player:set_pos(pos) return true end return false end minetest.register_privilege("home", { - description = "Can use /sethome and /home", + description = S("Can use /sethome and /home"), give_to_singleplayer = false }) minetest.register_chatcommand("home", { - description = "Teleport you to your home point", + description = S("Teleport you to your home point"), privs = {home = true}, func = function(name) - if sethome.go(name) then - return true, "Teleported to home!" + local player = minetest.get_player_by_name(name) + if not player then + return false, S("This command can only be executed in-game!") end - return false, "Set a home using /sethome" + if sethome.go(name) then + return true, S("Teleported to home!") + end + return false, S("Set a home using /sethome") end, }) minetest.register_chatcommand("sethome", { - description = "Set your home point", + description = S("Set your home point"), privs = {home = true}, func = function(name) name = name or "" -- fallback to blank name if nil local player = minetest.get_player_by_name(name) - if player and sethome.set(name, player:getpos()) then - return true, "Home set!" + if player and sethome.set(name, player:get_pos()) then + return true, S("Home set!") end - return false, "Player not found!" + return false, S("Player not found!") end, }) diff --git a/mods/sethome/locale/sethome.de.tr b/mods/sethome/locale/sethome.de.tr new file mode 100644 index 0000000..c59b26e --- /dev/null +++ b/mods/sethome/locale/sethome.de.tr @@ -0,0 +1,9 @@ +# 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! +Set a home using /sethome=Ein Zuhause mit /sethome setzen +Set your home point=Ihren Zuhause-Punkt setzen +Home set!=Zuhause gesetzt! +Player not found!=Spieler nicht gefunden! 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 new file mode 100644 index 0000000..661bc62 --- /dev/null +++ b/mods/sethome/locale/sethome.es.tr @@ -0,0 +1,9 @@ +# 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! +Set a home using /sethome=Establece tu hogar usando /sethome +Set your home point=Establece el sitio de tu hogar +Home set!=¡Hogar establecido! +Player not found!=¡Jugador no encontrado! diff --git a/mods/sethome/locale/sethome.fr.tr b/mods/sethome/locale/sethome.fr.tr new file mode 100644 index 0000000..01345e0 --- /dev/null +++ b/mods/sethome/locale/sethome.fr.tr @@ -0,0 +1,9 @@ +# 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 ! +Set a home using /sethome=Définir un domicile en utilisant /sethome +Set your home point=Définir votre domicile +Home set!=Domicile défini ! +Player not found!=Joueur non trouvé ! 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 new file mode 100644 index 0000000..4f1d757 --- /dev/null +++ b/mods/sethome/locale/sethome.it.tr @@ -0,0 +1,9 @@ +# 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 new file mode 100644 index 0000000..26a771c --- /dev/null +++ b/mods/sethome/locale/sethome.ms.tr @@ -0,0 +1,9 @@ +# 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! +Set a home using /sethome=Tetapkan rumah menggunakan /sethome +Set your home point=Tetapkan titik rumah anda +Home set!=Rumah ditetapkan! +Player not found!=Pemain tidak dijumpai! 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 new file mode 100644 index 0000000..75b2d49 --- /dev/null +++ b/mods/sethome/locale/sethome.ru.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.se.tr b/mods/sethome/locale/sethome.se.tr new file mode 100644 index 0000000..6077e4a --- /dev/null +++ b/mods/sethome/locale/sethome.se.tr @@ -0,0 +1,8 @@ +# textdomain: sethome +Can use /sethome and /home=Kan används /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 inte hittad! \ No newline at end of file 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 new file mode 100644 index 0000000..6e05576 --- /dev/null +++ b/mods/sethome/locale/sethome.zh_CN.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_TW.tr b/mods/sethome/locale/sethome.zh_TW.tr new file mode 100644 index 0000000..c5e455c --- /dev/null +++ b/mods/sethome/locale/sethome.zh_TW.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/template.txt b/mods/sethome/locale/template.txt new file mode 100644 index 0000000..f91c719 --- /dev/null +++ b/mods/sethome/locale/template.txt @@ -0,0 +1,9 @@ +# textdomain: sethome +This command can only be executed in-game!= +Can use /sethome and /home= +Teleport you to your home point= +Teleported to home!= +Set a home using /sethome= +Set your home point= +Home set!= +Player not found!= diff --git a/mods/sethome/mod.conf b/mods/sethome/mod.conf new file mode 100644 index 0000000..87ebbe7 --- /dev/null +++ b/mods/sethome/mod.conf @@ -0,0 +1,2 @@ +name = sethome +description = HOME manager support in game