Implement some more helper methods and proper copy in modlist

This commit is contained in:
2025-03-16 22:30:10 +01:00
parent 5deaf35b95
commit 51d9526aa3

View File

@@ -196,6 +196,18 @@ class ModList {
} }
} }
void enableMods(List<String> modIds) {
for (final modId in modIds) {
setEnabled(modId, true);
}
}
void disableMods(List<String> modIds) {
for (final modId in modIds) {
setEnabled(modId, false);
}
}
List<List<String>> checkIncompatibilities() { List<List<String>> checkIncompatibilities() {
List<List<String>> conflicts = []; List<List<String>> conflicts = [];
List<String> activeModIds = activeMods.keys.toList(); List<String> activeModIds = activeMods.keys.toList();
@@ -512,8 +524,8 @@ class ModList {
configPath: configPath ?? this.configPath, configPath: configPath ?? this.configPath,
modsPath: modsPath ?? this.modsPath, modsPath: modsPath ?? this.modsPath,
); );
newModlist.mods = mods ?? this.mods; newModlist.mods = Map.from(mods ?? this.mods);
newModlist.activeMods = activeMods ?? this.activeMods; newModlist.activeMods = Map.from(activeMods ?? this.activeMods);
return newModlist; return newModlist;
} }
} }