Fix NOMODS flag clearing the load order

Mods that don't have loadable scripts are forced on
This commit is contained in:
Map 2024-10-06 20:30:04 -05:00
parent b1719c4b21
commit a266c9508c

View file

@ -190,6 +190,7 @@ init -999 python:
# Contains the mod_name's of previous mods that have successfully loaded, mirroring mod_menu_metadata while in this loop. Only used for ID checking. # Contains the mod_name's of previous mods that have successfully loaded, mirroring mod_menu_metadata while in this loop. Only used for ID checking.
mod_name_list = [] mod_name_list = []
if load_metadata:
for file in loadable_mod_metadata: for file in loadable_mod_metadata:
mod_data_final = {} mod_data_final = {}
mod_jsonfail_list = [] # List of languages that has an associated metadata language file that failed to load. mod_jsonfail_list = [] # List of languages that has an associated metadata language file that failed to load.
@ -548,6 +549,11 @@ init -999 python:
if mod["ID"] == saved_mod_id[0]: if mod["ID"] == saved_mod_id[0]:
mod_not_found = False mod_not_found = False
if mod_not_found: if mod_not_found:
# If this mod doesn't have any loadable scripts, treat it as on (Say, if a mod changed something in the base game and the label points there)
if not mod["Scripts"]:
mod["Enabled"] = True
# Otherwise set mods to the default state
else:
mod["Enabled"] = persistent.newmods_default_state mod["Enabled"] = persistent.newmods_default_state
temp_list.append(mod) temp_list.append(mod)
@ -555,6 +561,7 @@ init -999 python:
# Rewrite enabled_mods to reflect the new mod order, and load all the mods # Rewrite enabled_mods to reflect the new mod order, and load all the mods
persistent.enabled_mods.clear() persistent.enabled_mods.clear()
for mod in mod_menu_metadata: for mod in mod_menu_metadata:
persistent.enabled_mods.append( [ mod["ID"], mod["Enabled"] ] ) persistent.enabled_mods.append( [ mod["ID"], mod["Enabled"] ] )