Mainmenu: Fix issues while trying to enable all mods (#5770)
parent
e25a38e3fb
commit
674400523e
|
@ -49,7 +49,7 @@ local function get_formspec(data)
|
||||||
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
|
"button[3.25,7;2.5,0.5;btn_config_world_save;" .. fgettext("Save") .. "]" ..
|
||||||
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
|
"button[5.75,7;2.5,0.5;btn_config_world_cancel;" .. fgettext("Cancel") .. "]"
|
||||||
|
|
||||||
if mod and mod.name ~= "" and mod.typ ~= "game_mod" then
|
if mod and mod.name ~= "" and not mod.is_game_content then
|
||||||
if mod.is_modpack then
|
if mod.is_modpack then
|
||||||
local rawlist = data.list:get_raw_list()
|
local rawlist = data.list:get_raw_list()
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ end
|
||||||
local function enable_mod(this, toset)
|
local function enable_mod(this, toset)
|
||||||
local mod = this.data.list:get_list()[this.data.selected_mod]
|
local mod = this.data.list:get_list()[this.data.selected_mod]
|
||||||
|
|
||||||
if mod.typ == "game_mod" then
|
if mod.is_game_content then
|
||||||
-- game mods can't be enabled or disabled
|
-- game mods can't be enabled or disabled
|
||||||
elseif not mod.is_modpack then
|
elseif not mod.is_modpack then
|
||||||
if toset == nil then
|
if toset == nil then
|
||||||
|
@ -162,7 +162,7 @@ local function handle_buttons(this, fields)
|
||||||
local i,mod
|
local i,mod
|
||||||
for i,mod in ipairs(rawlist) do
|
for i,mod in ipairs(rawlist) do
|
||||||
if not mod.is_modpack and
|
if not mod.is_modpack and
|
||||||
mod.typ ~= "game_mod" then
|
not mod.is_game_content then
|
||||||
if modname_valid(mod.name) then
|
if modname_valid(mod.name) then
|
||||||
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
|
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
|
||||||
else
|
else
|
||||||
|
@ -198,7 +198,8 @@ local function handle_buttons(this, fields)
|
||||||
local list = this.data.list:get_raw_list()
|
local list = this.data.list:get_raw_list()
|
||||||
|
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
|
if not list[i].is_game_content
|
||||||
|
and not list[i].is_modpack then
|
||||||
list[i].enabled = true
|
list[i].enabled = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -210,7 +211,8 @@ local function handle_buttons(this, fields)
|
||||||
local list = this.data.list:get_raw_list()
|
local list = this.data.list:get_raw_list()
|
||||||
|
|
||||||
for i = 1, #list do
|
for i = 1, #list do
|
||||||
if list[i].typ ~= "game_mod" and not list[i].is_modpack then
|
if not list[i].is_game_content
|
||||||
|
and not list[i].is_modpack then
|
||||||
list[i].enabled = false
|
list[i].enabled = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -252,9 +254,9 @@ function create_configure_world_dlg(worldidx)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
function(element,criteria)
|
function(element, criteria)
|
||||||
if criteria.hide_game and
|
if criteria.hide_game and
|
||||||
element.typ == "game_mod" then
|
element.is_game_content then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ function modmgr.render_modlist(render_list)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif v.typ == "game_mod" or v.typ == "game" then
|
elseif v.is_game_content then
|
||||||
color = mt_color_blue
|
color = mt_color_blue
|
||||||
elseif v.enabled then
|
elseif v.enabled then
|
||||||
color = mt_color_green
|
color = mt_color_green
|
||||||
|
@ -417,12 +417,14 @@ function modmgr.preparemodlist(data)
|
||||||
-- Add title
|
-- Add title
|
||||||
retval[#retval + 1] = {
|
retval[#retval + 1] = {
|
||||||
typ = "game",
|
typ = "game",
|
||||||
|
is_game_content = true,
|
||||||
name = fgettext("Subgame Mods")
|
name = fgettext("Subgame Mods")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,#game_mods,1 do
|
for i=1,#game_mods,1 do
|
||||||
game_mods[i].typ = "game_mod"
|
game_mods[i].typ = "game_mod"
|
||||||
|
game_mods[i].is_game_content = true
|
||||||
retval[#retval + 1] = game_mods[i]
|
retval[#retval + 1] = game_mods[i]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ void Client::initMods()
|
||||||
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
|
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
|
||||||
throw ModError("Error loading mod \"" + mod.name +
|
throw ModError("Error loading mod \"" + mod.name +
|
||||||
"\": Mod name does not follow naming conventions: "
|
"\": Mod name does not follow naming conventions: "
|
||||||
"Only chararacters [a-z0-9_] are allowed.");
|
"Only characters [a-z0-9_] are allowed.");
|
||||||
}
|
}
|
||||||
std::string script_path = mod.path + DIR_DELIM + "init.lua";
|
std::string script_path = mod.path + DIR_DELIM + "init.lua";
|
||||||
infostream << " [" << padStringRight(mod.name, 12) << "] [\""
|
infostream << " [" << padStringRight(mod.name, 12) << "] [\""
|
||||||
|
|
|
@ -283,7 +283,7 @@ Server::Server(
|
||||||
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
|
if (!string_allowed(mod.name, MODNAME_ALLOWED_CHARS)) {
|
||||||
throw ModError("Error loading mod \"" + mod.name +
|
throw ModError("Error loading mod \"" + mod.name +
|
||||||
"\": Mod name does not follow naming conventions: "
|
"\": Mod name does not follow naming conventions: "
|
||||||
"Only chararacters [a-z0-9_] are allowed.");
|
"Only characters [a-z0-9_] are allowed.");
|
||||||
}
|
}
|
||||||
std::string script_path = mod.path + DIR_DELIM + "init.lua";
|
std::string script_path = mod.path + DIR_DELIM + "init.lua";
|
||||||
infostream << " [" << padStringRight(mod.name, 12) << "] [\""
|
infostream << " [" << padStringRight(mod.name, 12) << "] [\""
|
||||||
|
|
|
@ -141,7 +141,7 @@ void LBMManager::addLBMDef(LoadingBlockModifierDef *lbm_def)
|
||||||
if (!string_allowed(lbm_def->name, LBM_NAME_ALLOWED_CHARS)) {
|
if (!string_allowed(lbm_def->name, LBM_NAME_ALLOWED_CHARS)) {
|
||||||
throw ModError("Error adding LBM \"" + lbm_def->name +
|
throw ModError("Error adding LBM \"" + lbm_def->name +
|
||||||
"\": Does not follow naming conventions: "
|
"\": Does not follow naming conventions: "
|
||||||
"Only chararacters [a-z0-9_:] are allowed.");
|
"Only characters [a-z0-9_:] are allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lbm_defs[lbm_def->name] = lbm_def;
|
m_lbm_defs[lbm_def->name] = lbm_def;
|
||||||
|
|
Loading…
Reference in New Issue