mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 07:30:41 +09:00
Refuse mod packs for a newer Factorio than the instance runs (#1015)
The mod pack's Factorio version ends up in mod-settings.dat. Factorio refuses to read that file when the version is newer than the game and falls back to default settings, which can wreck the save. Check the versions in syncMods before touching the mods folder. Closes #1006 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b0f629b6e
commit
9c97eeb597
2 files changed
+48
No files matched your search
@@ -38,6 +38,34 @@ describe("class Instance", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe(".checkModPackVersion()", function() {
|
||||
function modPack(factorioVersion) {
|
||||
return lib.ModPack.fromJSON({ name: "pack", factorio_version: factorioVersion });
|
||||
}
|
||||
|
||||
it("should accept a mod pack for an older or equal Factorio version", function() {
|
||||
instance.server.version = "1.1.91";
|
||||
instance.checkModPackVersion(modPack("1.1"));
|
||||
instance.checkModPackVersion(modPack("1.1.90"));
|
||||
instance.checkModPackVersion(modPack("1.1.91"));
|
||||
});
|
||||
|
||||
it("should reject a mod pack for a newer Factorio version", function() {
|
||||
instance.server.version = "1.1.91";
|
||||
assert.throws(
|
||||
() => instance.checkModPackVersion(modPack("1.1.110")),
|
||||
new lib.RequestError(
|
||||
"Mod pack pack is for Factorio 1.1.110 which is newer than the Factorio 1.1.91 this instance runs"
|
||||
)
|
||||
);
|
||||
assert.throws(() => instance.checkModPackVersion(modPack("2.0")), lib.RequestError);
|
||||
});
|
||||
|
||||
it("should skip the check when the server version is unknown", function() {
|
||||
instance.checkModPackVersion(modPack("2.0"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("._recordPlayerJoin()", function() {
|
||||
it("should add player to playersOnline", function() {
|
||||
instance._recordPlayerJoin("player");
|
||||
|
||||
Reference in new issue
Block a user