From 5adbb0283b3a0e5f4312d3d82a3fe24d1b9fb545 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Mon, 5 Oct 2026 00:10:19 +0000 Subject: [PATCH] Sync a death on instances that don't sync the controller A player who died on an instance syncing inventories but not the controller uploaded no character, so the controller kept the stored one and the player got their items back on the next join while the corpse still held them. The scenario now respawns the ghost for a moment, as the controller synced path already does to read the hidden inventory, and uploads that character. Co-Authored-By: Claude Opus 5.5 --- plugins/player_sync/README.md | 2 +- plugins/player_sync/module/serialize.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/player_sync/README.md b/plugins/player_sync/README.md index 0cdcd142..614074dc 100644 --- a/plugins/player_sync/README.md +++ b/plugins/player_sync/README.md @@ -106,7 +106,7 @@ Defaults to `true`. Sync the character inventories, the character bonuses and the crafting queue. While the controller is not synced a player without a character keeps what they have on the instance and does not change the stored character. -A player waiting to respawn is respawned straight away if there is a synced character to give them. +A player who died on the instance uploads the character they will respawn with, and a player waiting to respawn when joining is respawned straight away if there is a synced character to give them. Defaults to `true`. diff --git a/plugins/player_sync/module/serialize.lua b/plugins/player_sync/module/serialize.lua index ba8ad094..6351728a 100644 --- a/plugins/player_sync/module/serialize.lua +++ b/plugins/player_sync/module/serialize.lua @@ -857,21 +857,23 @@ function serialize.serialize_player(player, failed_deserialization, components) end -- For the waiting to respawn state the inventory logistic requests and filters are hidden on the player - if sync_controller and (sync_inventories or sync_logistics) - and player.controller_type == defines.controllers.ghost and player.ticks_to_respawn - then + if sync_inventories and player.controller_type == defines.controllers.ghost and player.ticks_to_respawn then + local ticks_to_respawn = player.ticks_to_respawn player.ticks_to_respawn = nil -- Respawn now if sync_logistics then serialized.personal_logistic_slots = serialize.serialize_personal_logistic_slots(player) end - if sync_inventories then + if sync_controller then serialized.inventories = serialize.serialize_inventories(player, character_inventories) + elseif player.character then + -- Without the controller the death is synced by uploading the respawned character + serialized.character = serialize.serialize_character(player.character) end -- Go back to waiting for respawn local character = player.character - player.ticks_to_respawn = serialized.ticks_to_respawn + player.ticks_to_respawn = ticks_to_respawn if character and character.valid then character.destroy() end