Improve world configure menu (#7922)

Replace `Subgame mods` with <game name> mods.
Display game description on left instead of dependencies.
Fix double DIR_DELIM in some paths.
This commit is contained in:
Paul Ouellette 2018-12-02 18:41:05 -05:00 committed by Nils Dagsson Moskopp
parent f394f47079
commit 43ddecfffd
Signed by: erle
GPG Key ID: A3BC671C35191080
2 changed files with 16 additions and 11 deletions

View File

@ -33,11 +33,15 @@ local function get_formspec(data)
local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path) local hard_deps, soft_deps = pkgmgr.get_dependencies(mod.path)
if mod.is_modpack then if mod.is_modpack or mod.type == "game" then
local info = minetest.formspec_escape( local info = minetest.formspec_escape(
core.get_content_info(mod.path).description) core.get_content_info(mod.path).description)
if info == "" then if info == "" then
if mod.is_modpack then
info = fgettext("No modpack description provided.") info = fgettext("No modpack description provided.")
else
info = fgettext("No game description provided.")
end
end end
retval = retval .. retval = retval ..
"textarea[0.25,0.7;5.75,7.2;;" .. info .. ";]" "textarea[0.25,0.7;5.75,7.2;;" .. info .. ";]"
@ -63,12 +67,12 @@ local function get_formspec(data)
if pkgmgr.is_modpack_entirely_enabled(data, mod.name) then if pkgmgr.is_modpack_entirely_enabled(data, mod.name) then
retval = retval .. retval = retval ..
"button[5.5,0.125;2.5,0.5;btn_mp_disable;" .. "button[5.5,0.125;3,0.5;btn_mp_disable;" ..
fgettext("Disable MP") .. "]" fgettext("Disable modpack") .. "]"
else else
retval = retval .. retval = retval ..
"button[5.5,0.125;2.5,0.5;btn_mp_enable;" .. "button[5.5,0.125;3,0.5;btn_mp_enable;" ..
fgettext("Enable MP") .. "]" fgettext("Enable modpack") .. "]"
end end
else else
retval = retval .. retval = retval ..
@ -78,11 +82,11 @@ local function get_formspec(data)
end end
if enabled_all then if enabled_all then
retval = retval .. retval = retval ..
"button[8.75,0.125;2.5,0.5;btn_disable_all_mods;" .. "button[8.95,0.125;2.5,0.5;btn_disable_all_mods;" ..
fgettext("Disable all") .. "]" fgettext("Disable all") .. "]"
else else
retval = retval .. retval = retval ..
"button[8.75,0.125;2.5,0.5;btn_enable_all_mods;" .. "button[8.95,0.125;2.5,0.5;btn_enable_all_mods;" ..
fgettext("Enable all") .. "]" fgettext("Enable all") .. "]"
end end
return retval .. return retval ..

View File

@ -21,7 +21,7 @@ function get_mods(path,retval,modpack)
for _, name in ipairs(mods) do for _, name in ipairs(mods) do
if name:sub(1, 1) ~= "." then if name:sub(1, 1) ~= "." then
local prefix = path .. DIR_DELIM .. name .. DIR_DELIM local prefix = path .. DIR_DELIM .. name
local toadd = {} local toadd = {}
retval[#retval + 1] = toadd retval[#retval + 1] = toadd
@ -39,7 +39,7 @@ function get_mods(path,retval,modpack)
if modpack ~= nil and modpack ~= "" then if modpack ~= nil and modpack ~= "" then
toadd.modpack = modpack toadd.modpack = modpack
else else
local modpackfile = io.open(prefix .. "modpack.txt") local modpackfile = io.open(prefix .. DIR_DELIM .. "modpack.txt")
if modpackfile then if modpackfile then
modpackfile:close() modpackfile:close()
toadd.type = "modpack" toadd.type = "modpack"
@ -532,7 +532,8 @@ function pkgmgr.preparemodlist(data)
retval[#retval + 1] = { retval[#retval + 1] = {
type = "game", type = "game",
is_game_content = true, is_game_content = true,
name = fgettext("Subgame Mods") name = fgettext(gamespec.name .. " mods"),
path = gamespec.path
} }
end end