Merge remote-tracking branch 'upstream/master' into refactor/plugin-hooks-v2

# Conflicts:
#	packages/lib/src/data/messages_plugin.ts
#	packages/web_ui/src/components/PluginViewPage.tsx
#	test/lib/plugin.js
This commit is contained in:
bbassie committed 2026-09-12 18:07:12 +00:00
commit db84455c34
37 files changed
+573 -60

No files matched your search

+20
View File
@@ -791,6 +791,7 @@ end`.replace(/\r?\n/g, " ");
} else {
modPack = await this.sendTo("controller", new lib.ModPackGetRequest(modPackId));
}
this.checkModPackVersion(modPack);
this.activeModPack = modPack;
const mods = await this._host.fetchMods(modPack.mods.values(), modPack.factorioVersion);
@@ -842,6 +843,25 @@ end`.replace(/\r?\n/g, " ");
await fs.writeFile(this.path("mods", "mod-settings.dat"), this.activeModPack.toModSettingsDat());
}
/**
* Check that the mod pack does not target a newer Factorio than the server
*
* The mod pack's Factorio version is written into mod-settings.dat and
* Factorio refuses to read it if it is newer than the game. It then
* loads default settings instead, which can corrupt the save.
*
* @throws {lib.RequestError} if the mod pack version is higher than the server version.
*/
checkModPackVersion(modPack: lib.ModPack) {
const serverVersion = this.server.version;
if (serverVersion && modPack.integerFactorioVersion > lib.integerFullVersion(serverVersion)) {
throw new lib.RequestError(
`Mod pack ${modPack.name} is for Factorio ${modPack.factorioVersion} ` +
`which is newer than the Factorio ${serverVersion} this instance runs`
);
}
}
/**
* Prepare instance for starting
*