Strip downloads by the components the scenario started them with

The instance read its config when the controller answered, so a sync_
field changed during the download could strip a component the scenario
still expected, and the scenario treated it as empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-17 15:25:06 +00:00
1 parent aa06b9afe3
commit 45fedf28a0
5 files changed
+26 -18

No files matched your search

+9 -4
View File
@@ -129,14 +129,19 @@ describe("player_sync", function() {
const expected = { generation: 1, name: "test", recipe_notifications: await encode({ add: ["a"] }) };
assert.deepEqual(instance.server.rconCommands, [downloadCommand(expected)]);
});
it("should leave out components the instance does not sync", async function() {
instance.mockConfigEntries.set("player_sync.sync_force", false);
instance.mockConfigEntries.set("player_sync.sync_recipe_notifications", false);
it("should leave out components the download was not started with", async function() {
respondWith({ generation: 1, name: "test", force: "enemy", tag: "tag", recipe_notifications: "x" });
await download({ player_name: "test" });
await download({ player_name: "test", components: { appearance: true } });
const expected = { generation: 1, name: "test", tag: "tag" };
assert.deepEqual(instance.server.rconCommands, [downloadCommand(expected)]);
});
it("should ignore config changes made after the download was started", async function() {
instance.mockConfigEntries.set("player_sync.sync_force", false);
respondWith({ generation: 1, name: "test", force: "enemy", tag: "tag" });
await download({ player_name: "test", components: { force: true } });
const expected = { generation: 1, name: "test", force: "enemy" };
assert.deepEqual(instance.server.rconCommands, [downloadCommand(expected)]);
});
});
describe("set_components", function() {