Files
factorio-clusterio/plugins/player_sync/index.ts
T
bbassieandClaude Opus 5.5 8363c5f0ef Rename inventory_sync to player_sync
The plugin syncs more than inventories now (settings, appearance, recipe
notifications), so name it for what it does. The package becomes
@clusterio/plugin-player_sync and every inventory_sync identifier follows.

A migration entrypoint renames the inventory_sync config fields, including
load_plugin, and the inventory view permission. The plugin moves
inventories.json in the database directory to player_sync.json and
storage.inventory_sync in saves to storage.player_sync itself, and closes
dialogs left open under the old GUI names on startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 16:37:12 +00:00

68 lines
1.6 KiB
TypeScript

import * as lib from "@clusterio/lib";
import * as messages from "./messages.js";
declare module "@clusterio/lib" {
export interface InstanceConfigFields {
"player_sync.rcon_chunk_size": number;
}
export interface ControllerConfigFields {
"player_sync.player_lock_timeout": number;
}
export interface Permissions {
"player_sync.inventory.view": never;
}
}
export const plugin: lib.PluginDeclaration = {
name: "player_sync",
title: "Player sync",
description: "Synchronizes player inventories and settings between instances",
migrationEntrypoint: "dist/node/migrations.js",
instanceEntrypoint: "dist/node/instance.js",
instanceConfigFields: {
"player_sync.rcon_chunk_size": {
title: "Rcon inventory chunk size",
description:
"Divide inventories into chunks of this size before sending with rcon to prevent blocking the pipe",
type: "number",
initialValue: 1000,
},
},
controllerEntrypoint: "dist/node/controller.js",
controllerConfigFields: {
"player_sync.player_lock_timeout": {
title: "Player Lock Timeout",
description:
"Time in seconds before the lock on a player inventory expires after an instance stops " +
"or is disconnected",
type: "number",
initialValue: 60,
},
},
features: [
"SavePatching",
"ScriptCommands",
],
messages: [
messages.AcquireRequest,
messages.ReleaseRequest,
messages.UploadRequest,
messages.DownloadRequest,
messages.DatabaseStatsRequest,
],
permissions: [
{
name: "player_sync.inventory.view",
title: "View player inventories",
description: "View player inventories",
grantByDefault: true,
},
],
webEntrypoint: "./web",
routes: ["/inventory"],
};