mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0e07ea73b
commit
5adbb0283b
2 files changed
+8
-6
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user