mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Unpatch saves started with save patching disabled
Turning factorio.enable_save_patching off did nothing to a save that was patched before. Its control.lua still loaded every module, so the clusterio_api interface, player_sync's join handling and the other module event handlers kept running with no plugin on the host side. When patching is disabled the instance now restores the original control.lua that patching kept as scenario.lua and removes the module files, locale files included, as listed in clusterio.json. The patch info stays with an empty module list so the patch number keeps counting. Otherwise patching the save again would reuse the number stored in the game and on_server_startup would not be raised. Data the modules put in storage is left alone. PatchInfo.fromSave dropped the version read from the save, so the check against newer patch versions never fired. It now keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6eaf48aefe
commit
ca3dbab49d
6 files changed
+229
-49
No files matched your search
@@ -153,6 +153,25 @@ describe("Clusterio Instance", function() {
|
||||
assert.deepEqual(whitelist, ["test_user"]);
|
||||
});
|
||||
});
|
||||
describe("save patching disabled", function() {
|
||||
it("should remove the modules from a save patched before", async function() {
|
||||
this.timeout(40000);
|
||||
const hasApi = "/sc rcon.print(tostring(remote.interfaces.clusterio_api ~= nil))";
|
||||
await execCtl(`${instSetConfig} factorio.enable_save_patching true`);
|
||||
await execCtl(`instance save create ${instName}`);
|
||||
await execCtl(`instance start ${instName}`);
|
||||
assert.equal(await sendRcon(instId, hasApi), "true\n");
|
||||
await execCtl(`instance stop ${instName}`);
|
||||
|
||||
await execCtl(`${instSetConfig} factorio.enable_save_patching false`);
|
||||
await execCtl(`instance start ${instName}`);
|
||||
try {
|
||||
assert.equal(await sendRcon(instId, hasApi), "false\n");
|
||||
} finally {
|
||||
await execCtl(`instance stop ${instName}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
for (const [savePatchingEnabled, scriptCommandsEnabled] of testMatrix([true, false], [true, false])) {
|
||||
const strSavePatching = `save patching: ${savePatchingEnabled ? "Enabled" : "Disabled"}`;
|
||||
const strScriptCommands = `script commands: ${scriptCommandsEnabled ? "Enabled" : "Disabled"}`;
|
||||
|
||||
Reference in new issue
Block a user