sethome - update mod to upstream

stable-5.2
mckaygerhard 2023-06-12 00:04:32 -04:00
parent b722a98fef
commit ae1ba2c463
21 changed files with 149 additions and 14 deletions

View File

@ -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 | |

View File

@ -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

View File

@ -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!

View File

@ -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!

View File

@ -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!

View File

@ -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 !

View File

@ -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!

View File

@ -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!
# 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!

View File

@ -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!=プレーヤーが見つかりません!

View File

@ -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

View File

@ -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!

View File

@ -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!

View File

@ -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!

View File

@ -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!=Вы телепортировались домой!

View File

@ -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ý!

View File

@ -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!

View File

@ -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!=Гравець не визначений!

View File

@ -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=设定您家的地点

View File

@ -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!=已傳送到家!

View File

@ -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!=

View File

@ -1,2 +1,2 @@
name = sethome
description = Minetest Game mod: sethome
description = HOME manager support in game