Skip to content

Commit b253d68

Browse files
committed
failsafe for legacy header and json in the same mod
1 parent bce91aa commit b253d68

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/preflight/loader.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,28 @@ function loadMods(modsDirectory)
506506
end
507507
end
508508

509+
-- i don't think it's even possible for a zip and a non-zip to share a blacklist name, but i'm still adding it just in case
510+
local function load_type_order(mod)
511+
return (mod.load_type == 'zip' and 2 or 0) + (mod.json and -1 or 0)
512+
end
509513
for k, mods in pairs(SMODS.Mods) do
510514
if mods[1] then
511515
-- we found more than one mod with this ID
516+
-- cull duplicates with the same blacklist name
517+
-- (such duplicates would always get disabled otherwise)
518+
local blacklist_dict = {}
519+
for _,mod in ipairs(mods) do
520+
blacklist_dict[mod.blacklist_name] = blacklist_dict[mod.blacklist_name] or {}
521+
table.insert(blacklist_dict[mod.blacklist_name], mod)
522+
end
523+
mods = {}
524+
-- prefer directories and json files
525+
for _,v in pairs(blacklist_dict) do
526+
if #v > 1 then
527+
table.sort(v, function(a,b) return load_type_order(a) < load_type_order(b) end)
528+
end
529+
table.insert(mods, v[1])
530+
end
512531
-- identify the highest enabled version
513532
local enabled_mods = {}
514533
for _,mod in ipairs(mods) do

version.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return "1.0.0~BETA-1531y-STEAMODDED"
1+
return "1.0.0~BETA-1531z-STEAMODDED"

0 commit comments

Comments
 (0)