mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Keep quick bar slots whose record is not in the blueprint library yet
A save gets a player's blueprint library from the client some seconds after the join. The data of a player new to the save is applied before that, so quick bar slots pointing at library records were cleared, and the next upload stored the quick bar without them. The entries are now kept. They are set once the record shows up, and an upload before that stores them again as they came. Fixes #1219 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JyNnVzRW4jPWaoWTxCyhM7
This commit is contained in:
1 parent
635b10a3dc
commit
0b0e2fd377
2 files changed
+90
-15
No files matched your search
@@ -634,6 +634,7 @@ player_sync.on_nth_tick[33] = function(event)
|
||||
player_sync.check_players_in_cutscene()
|
||||
player_sync.check_active_downloads()
|
||||
player_sync.check_active_uploads()
|
||||
player_sync.check_missing_quick_bar_records()
|
||||
end
|
||||
|
||||
player_sync.events[defines.events.on_cutscene_waypoint_reached] = function(event)
|
||||
@@ -781,6 +782,20 @@ function player_sync.check_active_downloads()
|
||||
end
|
||||
end
|
||||
|
||||
-- Quick bar slots pointing into the blueprint library are set once the save has the player's library
|
||||
function player_sync.check_missing_quick_bar_records()
|
||||
local script_data = get_script_data()
|
||||
for player_name, failed in pairs(script_data.failed_deserialization) do
|
||||
local player = failed.quick_bar and game.get_player(player_name)
|
||||
if player and player.connected then
|
||||
failed.quick_bar = serialize.restore_missing_quick_bar_records(player, failed.quick_bar)
|
||||
if not next(failed) then
|
||||
script_data.failed_deserialization[player_name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function player_sync.check_active_uploads()
|
||||
local script_data = get_script_data()
|
||||
for player_name, record in pairs(script_data.active_uploads) do
|
||||
|
||||
Reference in new issue
Block a user