From 0be4fd77e5002de2de52557df830cafc6009ce11 Mon Sep 17 00:00:00 2001 From: Floze <88098863+floze-the-genius@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:24:15 +0400 Subject: [PATCH] Allow disabling player online autosaves (#971) --- CHANGELOG.md | 1 + packages/lib/src/config/definitions.ts | 2 +- test/lib/config/validators.test.js | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14d7b789..52c13d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Many thanks to the following for contributing to this release: ### Fixes +- Allow player online autosave slots to be disabled while autosaves are enabled. [#966]() - Silenced two Ant Design console warnings in the Web UI: the deprecated Modal `destroyOnClose` prop, and a duplicate-value warning from the instance version selector. [#940]() - Surface the mod portal's own error when downloading mods for an unsupported Factorio version. [#941]() - Instances always create their config file on assignment preventing duplicate folder creation. [#945]() diff --git a/packages/lib/src/config/definitions.ts b/packages/lib/src/config/definitions.ts index ae2efbdb..406fe667 100644 --- a/packages/lib/src/config/definitions.ts +++ b/packages/lib/src/config/definitions.ts @@ -575,7 +575,7 @@ export class InstanceConfig extends classes.Config { validator: function(value, config) { const factorioSettings = config.get("factorio.settings"); const autosaveSlots = factorioSettings.autosave_slots; - if (typeof autosaveSlots === "number" && value < autosaveSlots) { + if (value !== 0 && typeof autosaveSlots === "number" && value < autosaveSlots) { throw new Error("Value cannot be less than the number of autosave slots"); } }, diff --git a/test/lib/config/validators.test.js b/test/lib/config/validators.test.js index d77a5b50..efa8e751 100644 --- a/test/lib/config/validators.test.js +++ b/test/lib/config/validators.test.js @@ -227,6 +227,15 @@ describe("lib/config/definitions/validators", function() { /Value cannot be less than the number of autosave slots/ ); }); + it("should allow disabling player online autosaves", function() { + const config = new InstanceConfig("controller", { + "factorio.settings": { + autosave_slots: 5, + }, + }); + + assert.doesNotThrow(() => config.set("factorio.player_online_autosave_slots", 0)); + }); it("should allow when autosave_slots is not a number", function() { const config = new InstanceConfig("controller", { "factorio.settings": {