Remove scenario.lua when unpatching a save

Unpatching moves scenario.lua back to control.lua instead of copying it, so the save only keeps clusterio.json for the patch number. Patching such a save again copies control.lua back to scenario.lua.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-04 17:21:19 +00:00
1 parent ca3dbab49d
commit 513d964a8b
2 files changed
+20 -5

No files matched your search

+3 -1
View File
@@ -309,7 +309,7 @@ describe("host/patch", function() {
const files = await readSave();
assert.deepEqual(
[...files.keys()].sort(),
["world/clusterio.json", "world/control.lua", "world/level.dat0", "world/scenario.lua"],
["world/clusterio.json", "world/control.lua", "world/level.dat0"],
);
assert.equal(files.get("world/control.lua"), freeplayControl);
const patchInfo = JSON.parse(files.get("world/clusterio.json"));
@@ -337,6 +337,8 @@ describe("host/patch", function() {
const files = await readSave();
assert.equal(JSON.parse(files.get("world/clusterio.json")).patch_number, 2);
assert(files.has("world/modules/test/test.lua"));
assert.equal(files.get("world/scenario.lua"), freeplayControl);
assert.match(files.get("world/control.lua"), /^-- Auto generated scenario module loader/);
});
it("should keep the loader of scenarios made for Clusterio", async function() {
const scenario = new lib.ModuleInfo("custom", "1.0.0", [], ["custom"]);