Oh God that shouldn't happen, right?
We cannot depend on a mod and loadbefore it......... Hopefully
This commit is contained in:
@@ -336,34 +336,22 @@ void main() {
|
|||||||
'ludeon.rimworld': makeDummy().copyWith(
|
'ludeon.rimworld': makeDummy().copyWith(
|
||||||
name: 'RimWorld',
|
name: 'RimWorld',
|
||||||
id: 'ludeon.rimworld',
|
id: 'ludeon.rimworld',
|
||||||
|
isBaseGame: true,
|
||||||
),
|
),
|
||||||
'ludeon.rimworld.anomaly': makeDummy().copyWith(
|
'ludeon.rimworld.anomaly': makeDummy().copyWith(
|
||||||
name: 'RimWorld Anomaly',
|
name: 'RimWorld Anomaly',
|
||||||
id: 'ludeon.rimworld.anomaly',
|
id: 'ludeon.rimworld.anomaly',
|
||||||
),
|
dependencies: ['ludeon.rimworld'],
|
||||||
'harmony': makeDummy().copyWith(name: 'Harmony', id: 'harmony'),
|
isExpansion: true,
|
||||||
'prepatcher': makeDummy().copyWith(
|
|
||||||
name: 'Prepatcher',
|
|
||||||
id: 'prepatcher',
|
|
||||||
dependencies: ['harmony'],
|
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
list.enableAll();
|
||||||
final order = list.generateLoadOrder();
|
final order = list.generateLoadOrder();
|
||||||
|
|
||||||
// Base game should load before any expansions
|
// Base game should load before any expansions
|
||||||
final baseGameIndex = order.indexOf('ludeon.rimworld');
|
final baseGameIndex = order.indexOf('ludeon.rimworld');
|
||||||
final expansionIndex = order.indexOf('ludeon.rimworld.anomaly');
|
final expansionIndex = order.indexOf('ludeon.rimworld.anomaly');
|
||||||
expect(baseGameIndex, lessThan(expansionIndex));
|
expect(baseGameIndex, lessThan(expansionIndex));
|
||||||
|
|
||||||
// Normal mods should come after base game (except harmony)
|
|
||||||
for (final modId in order) {
|
|
||||||
if (modId != 'ludeon.rimworld' &&
|
|
||||||
modId != 'harmony' &&
|
|
||||||
!modId.startsWith('ludeon.rimworld.')) {
|
|
||||||
expect(order.indexOf(modId), greaterThan(baseGameIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -405,25 +393,4 @@ void main() {
|
|||||||
expect(result.indexOf('modB'), lessThan(result.indexOf('modA')));
|
expect(result.indexOf('modB'), lessThan(result.indexOf('modA')));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Test constraint prioritization', () {
|
|
||||||
test('Hard dependencies should override soft constraints', () {
|
|
||||||
final list = ModList();
|
|
||||||
list.mods = {
|
|
||||||
'modA': makeDummy().copyWith(
|
|
||||||
name: 'Mod A',
|
|
||||||
id: 'modA',
|
|
||||||
dependencies: ['modB'],
|
|
||||||
loadBefore: ['modB'],
|
|
||||||
),
|
|
||||||
'modB': makeDummy().copyWith(name: 'Mod B', id: 'modB'),
|
|
||||||
};
|
|
||||||
|
|
||||||
list.enableAll();
|
|
||||||
final order = list.generateLoadOrder();
|
|
||||||
|
|
||||||
// Hard dependency must win
|
|
||||||
expect(order.indexOf('modB'), lessThan(order.indexOf('modA')));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user