mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
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>
29 lines
1.1 KiB
Lua
29 lines
1.1 KiB
Lua
local compat = require("modules/clusterio/compat")
|
|
|
|
--- @param no_early_return boolean? True to always setup data
|
|
return function(no_early_return)
|
|
local player_sync = compat.script_data.player_sync
|
|
if player_sync and not no_early_return then
|
|
return player_sync
|
|
end
|
|
|
|
-- migrate: inventory_sync was renamed to player_sync in 2.0.0-alpha.28
|
|
if not player_sync and compat.script_data.inventory_sync then
|
|
player_sync = compat.script_data.inventory_sync
|
|
compat.script_data.inventory_sync = nil
|
|
end
|
|
|
|
player_sync = player_sync or {}
|
|
player_sync.players = player_sync.players or {}
|
|
player_sync.players_waiting_for_acquire = player_sync.players_waiting_for_acquire or {}
|
|
player_sync.players_in_cutscene_to_sync = player_sync.players_in_cutscene_to_sync or {}
|
|
player_sync.failed_deserialization = player_sync.failed_deserialization or {}
|
|
|
|
player_sync.active_downloads = player_sync.active_downloads or {}
|
|
player_sync.finished_downloads = player_sync.finished_downloads or {}
|
|
player_sync.active_uploads = player_sync.active_uploads or {}
|
|
|
|
compat.script_data.player_sync = player_sync
|
|
return player_sync
|
|
end
|