mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-27 17:28:41 +00:00
Merge 66316d2098
into aba2b6638e
This commit is contained in:
commit
fde21e7b03
5 changed files with 42 additions and 8 deletions
|
@ -85,8 +85,13 @@ local function check_mod_configuration(world_path, all_mods)
|
|||
|
||||
-- Build the table of errors
|
||||
local with_error = {}
|
||||
for _, mod in ipairs(config_status.satisfied_mods) do
|
||||
if not mod.valid then
|
||||
with_error[mod.virtual_path] = { type = "error", reason = "invalid" }
|
||||
end
|
||||
end
|
||||
for _, mod in ipairs(config_status.unsatisfied_mods) do
|
||||
local error = { type = "warning" }
|
||||
local error = { type = "warning", reason = "unsatisfied_depends" }
|
||||
with_error[mod.virtual_path] = error
|
||||
|
||||
for _, depname in ipairs(mod.unsatisfied_depends) do
|
||||
|
@ -155,6 +160,24 @@ local function get_formspec(data)
|
|||
local hard_deps_str = table.concat(hard_deps, ",")
|
||||
local soft_deps_str = table.concat(soft_deps, ",")
|
||||
|
||||
local error_message = ""
|
||||
|
||||
local error = with_error[mod.virtual_path]
|
||||
if error and
|
||||
error.type == "error" and
|
||||
-- do not display "unsatisfied_depends" error as message because is
|
||||
-- is displayed by dependency list
|
||||
error.reason ~= "unsatisfied_depends"
|
||||
then
|
||||
error_message = error_message ..
|
||||
minetest.colorize(mt_color_red, fgettext("Errors:")) .. "\n"
|
||||
if error.reason == "invalid" then
|
||||
error_message = error_message .. fgettext(
|
||||
"Mod is incomplete because it has no \"init.lua\" file. " ..
|
||||
"Dependencies are not visible because of this.")
|
||||
end
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"label[0,0.7;" .. fgettext("Mod:") .. "]" ..
|
||||
"label[0.75,0.7;" .. mod.name .. "]"
|
||||
|
@ -163,7 +186,8 @@ local function get_formspec(data)
|
|||
if soft_deps_str == "" then
|
||||
retval = retval ..
|
||||
"label[0,1.25;" ..
|
||||
fgettext("No (optional) dependencies") .. "]"
|
||||
fgettext("No (optional) dependencies") .. "]" ..
|
||||
"textarea[0.25,1.75;5.75,7.2;;" .. error_message .. ";]"
|
||||
else
|
||||
retval = retval ..
|
||||
"label[0,1.25;" .. fgettext("No hard dependencies") ..
|
||||
|
@ -171,7 +195,8 @@ local function get_formspec(data)
|
|||
"label[0,1.75;" .. fgettext("Optional dependencies:") ..
|
||||
"]" ..
|
||||
"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_message .. ";]"
|
||||
end
|
||||
else
|
||||
if soft_deps_str == "" then
|
||||
|
@ -179,7 +204,8 @@ local function get_formspec(data)
|
|||
"label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
|
||||
"textlist[0,1.75;5,4;world_config_depends;" ..
|
||||
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_message .. ";]"
|
||||
else
|
||||
retval = retval ..
|
||||
"label[0,1.25;" .. fgettext("Dependencies:") .. "]" ..
|
||||
|
@ -188,7 +214,8 @@ local function get_formspec(data)
|
|||
"label[0,3.9;" .. fgettext("Optional dependencies:") ..
|
||||
"]" ..
|
||||
"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_message .. ";]"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue