From cb450690ba3bbcfa25f2480ad922446b255b6122 Mon Sep 17 00:00:00 2001 From: ILLISIS Date: Tue, 20 Oct 2026 13:19:49 +1100 Subject: [PATCH] Restore the body's place on the download forced by a dropped copy The download a join forces after dropping a copy that took the body found the player already a spectator, so it kept the spectator's place and restored the character there. It now takes the surface, position and vehicle the dropped copy kept. Co-Authored-By: Claude Opus 5.5 (1M context) --- plugins/player_sync/module/player_sync.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/player_sync/module/player_sync.lua b/plugins/player_sync/module/player_sync.lua index a54d2633..1ee077f2 100644 --- a/plugins/player_sync/module/player_sync.lua +++ b/plugins/player_sync/module/player_sync.lua @@ -374,7 +374,7 @@ function player_sync.sync_player(acquire_response) -- holds. -- A copy confirmed at an earlier join already took the body (spectate keeps where it stood), and the local data -- went with it, so a join that drops that copy downloads. - local body_taken = false + local body_taken -- the dropped copy that took the body for _, downloads in ipairs({ script_data.finished_downloads, script_data.active_downloads }) do local record = downloads[acquire_response.player_name] if record and record.prefetch and (not ( @@ -382,7 +382,9 @@ function player_sync.sync_player(acquire_response) and (record.epoch or 0) == epoch and record.token == acquire_response.token and serialize.same_components(record.components, script_data.components) ) or not download_needed(script_data.players[acquire_response.player_name], acquire_response, script_data)) then - body_taken = body_taken or record.position ~= nil + if record.position ~= nil then + body_taken = record + end downloads[acquire_response.player_name] = nil end end @@ -479,6 +481,13 @@ function player_sync.sync_player(acquire_response) local stale = (player_record.epoch or 0) ~= epoch if body_taken or download_needed(player_record, acquire_response, script_data) then player_sync.initiate_inventory_download(player, player_record, acquire_response.generation, epoch) + if body_taken then + -- spectate kept the spectator's place, the body stood where the dropped copy kept + local download = script_data.active_downloads[player.name] + download.surface = body_taken.surface + download.position = body_taken.position + download.vehicle = body_taken.vehicle + end else if acquire_response.generation == 0 then