Skip to content
Snippets Groups Projects
Commit 59f74d2f authored by DarkGod's avatar DarkGod
Browse files

addons can disable other addons

parent 3cba9242
No related branches found
No related tags found
No related merge requests found
......@@ -490,6 +490,8 @@ function _M:loadAddons(mod, saveuse)
if saveuse then saveuse = table.reverse(saveuse) end
local force_remove_addons = {}
-- Filter based on settings
for i = #adds, 1, -1 do
local add = adds[i]
......@@ -523,32 +525,47 @@ function _M:loadAddons(mod, saveuse)
end
end
if add.dlc and add.dlc_files then
if not removed and add.dlc_files.classes then
for _, name in ipairs(add.dlc_files.classes) do
print("Preloading DLC class", name)
local data = profile:getDLCD(add.for_module.."-"..add.short_name, ("%d.%d.%d"):format(add.version[1],add.version[2],add.version[3]), name:gsub("%.", "/")..".lua")
if data and data ~= '' then
profile.dlc_files.classes[name] = data
elseif not __module_extra_info.ignore_addons_not_loading then
print("Removing addon "..add.short_name..": DLC class not received")
table.remove(adds, i) removed = true
if saveuse then
-- The savefile requires it, but we couldnt activate it, abord
core.game.setRebootMessage(([[The savefile requires the #YELLOW#%s#WHITE# addon.
if not removed then
if add.dlc and add.dlc_files then
if add.dlc_files.classes then
for _, name in ipairs(add.dlc_files.classes) do
print("Preloading DLC class", name)
local data = profile:getDLCD(add.for_module.."-"..add.short_name, ("%d.%d.%d"):format(add.version[1],add.version[2],add.version[3]), name:gsub("%.", "/")..".lua")
if data and data ~= '' then
profile.dlc_files.classes[name] = data
elseif not __module_extra_info.ignore_addons_not_loading then
print("Removing addon "..add.short_name..": DLC class not received")
table.remove(adds, i) removed = true
if saveuse then
-- The savefile requires it, but we couldnt activate it, abord
core.game.setRebootMessage(([[The savefile requires the #YELLOW#%s#WHITE# addon.
Some of its features require being online and could not be enabled. To prevent damaging the savefile loading was aborted.
You may try to force loading if you are sure the savefile does not use that addon, at your own risk, by checking the "Ignore unloadable addons" checkbox on the load game screen..]]):format(add.long_name))
util.showMainMenu(nil, nil, nil, nil, nil, nil, "show_ignore_addons_not_loading=true")
util.showMainMenu(nil, nil, nil, nil, nil, nil, "show_ignore_addons_not_loading=true")
end
break
else
add.dlc = "no"
print("Removing addon "..add.short_name..": dlc file required not found")
table.remove(adds, i) removed = true
end
break
else
add.dlc = "no"
print("Removing addon "..add.short_name..": dlc file required not found")
table.remove(adds, i) removed = true
end
end
end
if add.disable_addons then
table.merge(force_remove_addons, table.reverse(add.disable_addons))
end
end
end
-- Let addons disable addons!
for i = #adds, 1, -1 do
local add = adds[i]
if force_remove_addons[add.short_name] then
print("Removing addon "..add.short_name..": disabled by an other addon")
table.remove(adds, i)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment