The expansions must be loaded in correct order.... fuck

This commit is contained in:
2025-03-19 00:03:42 +01:00
parent 9eb71e94c1
commit 5f20368fe2
4 changed files with 50 additions and 12 deletions

View File

@@ -361,4 +361,4 @@ class Mod {
enabled: enabled ?? this.enabled, enabled: enabled ?? this.enabled,
); );
} }
} }

View File

@@ -240,7 +240,11 @@ class ModList {
final modId = modElement.innerText.toLowerCase(); final modId = modElement.innerText.toLowerCase();
if (specialMods.containsKey(modId)) { if (specialMods.containsKey(modId)) {
mods[modId] = specialMods[modId]!; logger.info('Loading special mod: $modId');
mods[modId] = specialMods[modId]!.copyWith();
setEnabled(modId, true);
logger.info('Enabled special mod: $modId');
yield mods[modId]!;
continue; continue;
} }
@@ -382,12 +386,14 @@ class ModList {
loadOrder ??= LoadOrder(); loadOrder ??= LoadOrder();
final logger = Logger.instance; final logger = Logger.instance;
logger.info('Generating load order...'); logger.info('Generating load order...');
for (final mod in activeMods.values) {
for (var mod in activeMods.values) {
logger.info('Checking mod: ${mod.id}'); logger.info('Checking mod: ${mod.id}');
if (specialMods.containsKey(mod.id)) { if (specialMods.containsKey(mod.id)) {
logger.info('Special mod: ${mod.id}'); logger.info('Special mod: ${mod.id}');
mod = specialMods[mod.id]!.copyWith(); // Replace our fake base game mod with the chad one
// This is a bit of a hack, but it works
activeMods[mod.id] = specialMods[mod.id]!.copyWith();
mods[mod.id] = specialMods[mod.id]!.copyWith();
} }
logger.info('Mod details: ${mod.toString()}'); logger.info('Mod details: ${mod.toString()}');
for (final incomp in mod.incompatibilities) { for (final incomp in mod.incompatibilities) {

View File

@@ -200,10 +200,10 @@ void main() {
final expected = [ final expected = [
'brrainz.harmony', 'brrainz.harmony',
'ludeon.rimworld', 'ludeon.rimworld',
'ludeon.rimworld.anomaly',
'ludeon.rimworld.biotech',
'ludeon.rimworld.ideology',
'ludeon.rimworld.royalty', 'ludeon.rimworld.royalty',
'ludeon.rimworld.ideology',
'ludeon.rimworld.biotech',
'ludeon.rimworld.anomaly',
'dubwise.rimatomics', 'dubwise.rimatomics',
'jecrell.doorsexpanded', 'jecrell.doorsexpanded',
'dubwise.rimefeller', 'dubwise.rimefeller',
@@ -304,10 +304,10 @@ void main() {
'brrainz.harmony', 'brrainz.harmony',
'ludeon.rimworld', 'ludeon.rimworld',
'bs.betterlog', 'bs.betterlog',
'ludeon.rimworld.anomaly',
'ludeon.rimworld.royalty', 'ludeon.rimworld.royalty',
'ludeon.rimworld.ideology', 'ludeon.rimworld.ideology',
'ludeon.rimworld.biotech', 'ludeon.rimworld.biotech',
'ludeon.rimworld.anomaly',
]; ];
expect(order.loadOrder, equals(expected)); expect(order.loadOrder, equals(expected));
}); });
@@ -712,10 +712,10 @@ void main() {
'brrainz.harmony', 'brrainz.harmony',
'ludeon.rimworld', 'ludeon.rimworld',
'bs.betterlog', 'bs.betterlog',
'ludeon.rimworld.anomaly',
'ludeon.rimworld.biotech',
'ludeon.rimworld.ideology',
'ludeon.rimworld.royalty', 'ludeon.rimworld.royalty',
'ludeon.rimworld.ideology',
'ludeon.rimworld.biotech',
'ludeon.rimworld.anomaly',
'rah.rbse', 'rah.rbse',
'mlie.usethisinstead', 'mlie.usethisinstead',
'dubwise.rimatomics', 'dubwise.rimatomics',

View File

@@ -182,6 +182,38 @@ void main() {
expect(result.errors, isEmpty); expect(result.errors, isEmpty);
expect(result.loadOrder, equals(expected)); expect(result.loadOrder, equals(expected));
}); });
test('Expansions should load in the correct order', () {
final list = ModList();
// Intentionally left barren because that's how we get it out of the box
// It is up to generateLoadOrder to fill in the details
list.mods = {
'ludeon.rimworld': makeDummy().copyWith(id: 'ludeon.rimworld'),
'ludeon.rimworld.anomaly': makeDummy().copyWith(
id: 'ludeon.rimworld.anomaly',
),
'ludeon.rimworld.ideology': makeDummy().copyWith(
id: 'ludeon.rimworld.ideology',
),
'ludeon.rimworld.biotech': makeDummy().copyWith(
id: 'ludeon.rimworld.biotech',
),
'ludeon.rimworld.royalty': makeDummy().copyWith(
id: 'ludeon.rimworld.royalty',
),
};
list.enableAll();
final result = list.generateLoadOrder();
final expected = [
'ludeon.rimworld',
'ludeon.rimworld.royalty',
'ludeon.rimworld.ideology',
'ludeon.rimworld.biotech',
'ludeon.rimworld.anomaly',
];
expect(result.errors, isEmpty);
expect(result.loadOrder, equals(expected));
});
}); });
group('Test loadRequired', () { group('Test loadRequired', () {