1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Small corrections in dlg_config_world.lua

This commit is contained in:
ZavGaro 2024-08-21 13:23:28 +03:00
parent eba2c7425d
commit 9b79e00d12

View file

@ -100,8 +100,7 @@ local function check_mod_configuration(world_path, all_mods)
local with_error = {} local with_error = {}
for _, mod in ipairs(config_status.satisfied_mods) do for _, mod in ipairs(config_status.satisfied_mods) do
if not mod.valid then if not mod.valid then
local error = { type = "error", reason = "invalid" } with_error[mod.virtual_path] = { type = "error", reason = "invalid" }
with_error[mod.virtual_path] = error
end end
end end
for _, mod in ipairs(config_status.unsatisfied_mods) do for _, mod in ipairs(config_status.unsatisfied_mods) do
@ -174,22 +173,22 @@ local function get_formspec(data)
local hard_deps_str = table.concat(hard_deps, ",") local hard_deps_str = table.concat(hard_deps, ",")
local soft_deps_str = table.concat(soft_deps, ",") local soft_deps_str = table.concat(soft_deps, ",")
local error_messages = "" local error_message = ""
local error = with_error[mod.virtual_path] local error = with_error[mod.virtual_path]
if error and if error and
error.type == "error" and error.type == "error" and
-- do not handle this error by message because is is handled by -- do not display "unsatisfied_depends" error as message because is
-- dependency list -- is displayed by dependency list
error.reason ~= "unsatisfied_depends" error.reason ~= "unsatisfied_depends"
then then
error_messages = error_messages .. error_message = error_message ..
fgettext(minetest.colorize(mt_color_red, "Errors:") .. "\n") fgettext(minetest.colorize(mt_color_red, "Errors:") .. "\n")
if error.reason == "invalid" then if error.reason == "invalid" then
error_messages = error_messages .. fgettext( error_message = error_message .. fgettext(
"Mod is incomplete because it has no \"init.lua\" file. " .. "Mod is incomplete because it has no \"init.lua\" file. " ..
"Dependencies are not visible because of this.") "Dependencies are not visible because of this.")
end end
end end
retval = retval .. retval = retval ..
@ -201,7 +200,7 @@ local function get_formspec(data)
retval = retval .. retval = retval ..
"label[0,1.25;" .. "label[0,1.25;" ..
fgettext("No (optional) dependencies") .. "]" .. fgettext("No (optional) dependencies") .. "]" ..
"textarea[0.25,1.75;5.75,7.2;;" .. error_messages .. ";]" "textarea[0.25,1.75;5.75,7.2;;" .. error_message .. ";]"
else else
retval = retval .. retval = retval ..
"label[0,1.25;" .. fgettext("No hard dependencies") .. "label[0,1.25;" .. fgettext("No hard dependencies") ..
@ -210,7 +209,7 @@ local function get_formspec(data)
"]" .. "]" ..
"textlist[0,2.25;5,4;world_config_optdepends;" .. "textlist[0,2.25;5,4;world_config_optdepends;" ..
soft_deps_str .. ";0]" .. soft_deps_str .. ";0]" ..
"textarea[0.25,6.5;3.45,1.75;;" .. error_messages .. ";]" "textarea[0.25,6.5;3.45,1.75;;" .. error_message .. ";]"
end end
else else
if soft_deps_str == "" then if soft_deps_str == "" then
@ -219,7 +218,7 @@ local function get_formspec(data)
"textlist[0,1.75;5,4;world_config_depends;" .. "textlist[0,1.75;5,4;world_config_depends;" ..
hard_deps_str .. ";0]" .. hard_deps_str .. ";0]" ..
"label[0,6;" .. fgettext("No optional dependencies") .. "]" .. "label[0,6;" .. fgettext("No optional dependencies") .. "]" ..
"textarea[0.25,6.5;3.45,1.75;;" .. error_messages .. ";]" "textarea[0.25,6.5;3.45,1.75;;" .. error_message .. ";]"
else else
retval = retval .. retval = retval ..
"label[0,1.25;" .. fgettext("Dependencies:") .. "]" .. "label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
@ -229,7 +228,7 @@ local function get_formspec(data)
"]" .. "]" ..
"textlist[0,4.375;5,1.8;world_config_optdepends;" .. "textlist[0,4.375;5,1.8;world_config_optdepends;" ..
soft_deps_str .. ";0]" .. soft_deps_str .. ";0]" ..
"textarea[0.25,6.5;3.45,1.75;;" .. error_messages .. ";]" "textarea[0.25,6.5;3.45,1.75;;" .. error_message .. ";]"
end end
end end
end end