Files
factorio-clusterio/plugins/player_sync/module/ensure_character.lua
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

13 lines
399 B
Lua

-- Ensures that the given player has a character if one doesn't exist
local function ensure_character(player)
if not player.character and not player.ticks_to_respawn then
if player.controller_type ~= defines.controllers.ghost then
player.set_controller({ type = defines.controllers.ghost })
end
player.ticks_to_respawn = 0
player.ticks_to_respawn = nil
end
end
return ensure_character