Allow inventory sync components to be turned off per instance

Adds an inventory_sync.sync_<component> instance config field for the
controller, force, appearance, inventories, logistics, quick bar,
settings and recipe notifications. All default to on, which keeps the
current behaviour.

A component which is off on an instance is left alone there and its
fields are not stored from that instance. The controller merges each
upload with the stored data using the uploading instance's config, the
instance strips the fields from downloads before sending them over RCON,
and the scenario is told the enabled set on start and when it changes so
it can skip serializing them and skip the steps which replace the
character.

The controller is only synced together with the inventories, as switching
controller can destroy the character holding them. Without the controller
synced the player gets back the controller they had on the instance, only
character inventories move between instances, and a player without a
character keeps their inventory.

Closes #968

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 e810020db5
commit 0e559cf000
11 files changed
+571 -81

No files matched your search

+60
View File
@@ -4,6 +4,14 @@ import * as messages from "./messages.js";
declare module "@clusterio/lib" {
export interface InstanceConfigFields {
"player_sync.rcon_chunk_size": number;
"player_sync.sync_controller": boolean;
"player_sync.sync_force": boolean;
"player_sync.sync_appearance": boolean;
"player_sync.sync_inventories": boolean;
"player_sync.sync_logistics": boolean;
"player_sync.sync_quick_bar": boolean;
"player_sync.sync_settings": boolean;
"player_sync.sync_recipe_notifications": boolean;
}
export interface ControllerConfigFields {
"player_sync.player_lock_timeout": number;
@@ -28,6 +36,58 @@ export const plugin: lib.PluginDeclaration = {
type: "number",
initialValue: 1000,
},
"player_sync.sync_controller": {
title: "Sync controller",
description:
"Sync whether the player is a character, god or spectator, their respawn timer and cheat " +
"mode. Only synced while inventories are synced too.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_force": {
title: "Sync force",
description: "Sync the force the player is on.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_appearance": {
title: "Sync appearance",
description: "Sync the player colour, chat colour and tag.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_inventories": {
title: "Sync inventories",
description:
"Sync the character and god inventories, character bonuses and crafting queue. Without the " +
"controller synced only the inventory of a character is synced.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_logistics": {
title: "Sync logistics",
description: "Sync the personal logistic requests.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_quick_bar": {
title: "Sync quick bar",
description: "Sync the quick bar.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_settings": {
title: "Sync settings",
description: "Sync the shortcut toggles, game view settings and flashlight.",
type: "boolean",
initialValue: true,
},
"player_sync.sync_recipe_notifications": {
title: "Sync recipe notifications",
description: "Sync which new recipe notifications have been seen.",
type: "boolean",
initialValue: true,
},
},
controllerEntrypoint: "dist/node/controller.js",