Compare commits
No commits in common. "6c241a7df70a9b03d2f5919993d7c78362e3405f" and "b2c53ad0325932ca067b819e959b6224d9d43dad" have entirely different histories.
6c241a7df7
...
b2c53ad032
19
init.lua
19
init.lua
|
@ -18,14 +18,13 @@ fs_themes.themes = {}
|
||||||
|
|
||||||
local storage = minetest.get_mod_storage()
|
local storage = minetest.get_mod_storage()
|
||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
local S = minetest.get_translator(minetest.get_current_modname());
|
|
||||||
|
|
||||||
|
|
||||||
-- Set a player’s theme by a registered theme’s name.
|
-- Set a player’s theme by a registered theme’s name.
|
||||||
-- If dont_save is provided, the player’s default theme won’t change.
|
-- If dont_save is provided, the player’s default theme won’t change.
|
||||||
function fs_themes.set_theme(player, theme_name, dont_save)
|
function fs_themes.set_theme(player, theme_name, dont_save)
|
||||||
if not fs_themes.themes[theme_name] then
|
if not fs_themes.themes[theme_name] then
|
||||||
minetest.log("warning", string.format(S("Theme “%s” was not found."), theme_name))
|
minetest.log("warning", string.format("Theme “%s” was not found.", theme_name))
|
||||||
return false
|
return false
|
||||||
elseif not dont_save then
|
elseif not dont_save then
|
||||||
storage:set_string(player:get_player_name(), theme_name)
|
storage:set_string(player:get_player_name(), theme_name)
|
||||||
|
@ -46,7 +45,7 @@ end
|
||||||
minetest.register_chatcommand(
|
minetest.register_chatcommand(
|
||||||
"themes",
|
"themes",
|
||||||
{
|
{
|
||||||
description = S("Lists available GUI (Formspecs) themes."),
|
description = "Lists available GUI (Formspecs) themes.",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local ret = nil
|
local ret = nil
|
||||||
for name,fs in pairs(fs_themes.themes) do
|
for name,fs in pairs(fs_themes.themes) do
|
||||||
|
@ -57,7 +56,7 @@ minetest.register_chatcommand(
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if ret == nil then
|
if ret == nil then
|
||||||
ret = S("No themes are installed!")
|
ret = "No themes are installed!"
|
||||||
end
|
end
|
||||||
return true, ret
|
return true, ret
|
||||||
end
|
end
|
||||||
|
@ -68,13 +67,13 @@ minetest.register_chatcommand(
|
||||||
minetest.register_chatcommand(
|
minetest.register_chatcommand(
|
||||||
"set_theme",
|
"set_theme",
|
||||||
{
|
{
|
||||||
params = S("<theme_name>"),
|
params = "<theme_name>",
|
||||||
description = S("Sets your theme for GUI (Formspecs) windows."),
|
description = "Sets your theme for GUI (Formspecs) windows.",
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if fs_themes.set_theme(minetest.get_player_by_name(name), param) then
|
if fs_themes.set_theme(minetest.get_player_by_name(name), param) then
|
||||||
return true, S("Theme set!")
|
return true, "Theme set!"
|
||||||
elseif param ~= "" then
|
elseif param ~= "" then
|
||||||
return false, string.format(S("No such theme “%s”."), param)
|
return false, string.format("No such theme “%s”.", param)
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -99,7 +98,7 @@ minetest.register_on_joinplayer(
|
||||||
if player_theme ~= "" and not fs_themes.set_theme(player, player_theme) then
|
if player_theme ~= "" and not fs_themes.set_theme(player, player_theme) then
|
||||||
minetest.chat_send_player(
|
minetest.chat_send_player(
|
||||||
player_name,
|
player_name,
|
||||||
string.format(S("The theme “%s” no longer exists! Resetting preference."), player_theme))
|
string.format("The theme “%s” no longer exists! Resetting preference.", player_theme))
|
||||||
player_theme = ""
|
player_theme = ""
|
||||||
storage:set_string(player_name, "")
|
storage:set_string(player_name, "")
|
||||||
end
|
end
|
||||||
|
@ -117,7 +116,7 @@ local theme_file_paths = minetest.get_dir_list(theme_dir_path, false)
|
||||||
for _, file_name in pairs(theme_file_paths) do
|
for _, file_name in pairs(theme_file_paths) do
|
||||||
local fs_file, open_err = io.open(theme_dir_path .. file_name, "r")
|
local fs_file, open_err = io.open(theme_dir_path .. file_name, "r")
|
||||||
if fs_file == nil then
|
if fs_file == nil then
|
||||||
minetest.log("warning", string.format(S("Theme “%s” could not be opened: %s"), name, open_err))
|
minetest.log("warning", string.format("Theme “%s” could not be opened: %s", name, open_err))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# textdomain: fs_themes
|
|
||||||
Theme “%s” was not found.=Stilo «%s» ne troviĝis.
|
|
||||||
Lists available GUI (Formspecs) themes.=Listigas uzeblajn stilojn por la fasado (Formspec).
|
|
||||||
No themes are installed!=Neniu stilo instalita!
|
|
||||||
<theme_name>=<stilonomo)
|
|
||||||
Sets your theme for GUI (Formspecs) windows.=Agordas vian stilon por la fasado (Formspec).
|
|
||||||
Theme set!=Stilo agordita!
|
|
||||||
No such theme “%s”.=Neniu stilo nomita «%s».
|
|
||||||
The theme “%s” no longer exists! Resetting preference.=La stilo «%s» ne plu ekzistas! Nuligas preferon.
|
|
||||||
Theme “%s” could not be opened: %s=Stilon «%s» ne povis legi!
|
|
|
@ -1,10 +0,0 @@
|
||||||
# textdomain: fs_themes
|
|
||||||
Theme “%s” was not found.=
|
|
||||||
Lists available GUI (Formspecs) themes.=
|
|
||||||
No themes are installed!=
|
|
||||||
<theme_name>=
|
|
||||||
Sets your theme for GUI (Formspecs) windows.=
|
|
||||||
Theme set!=
|
|
||||||
No such theme “%s”.=
|
|
||||||
The theme “%s” no longer exists! Resetting preference.=
|
|
||||||
Theme “%s” could not be opened: %s=
|
|
Ŝarĝante…
Reference in New Issue