mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Merge recipe notifications against the restored force (#1182)
The instance works out the recipe notification delta against the cleared list the player had when the download started, but the save applied it after the download restored player.force. A player whose force changed kept notifications they had cleared elsewhere, and recipes only the old force had dropped out of the failed list and were lost on the next upload. The download record now keeps the cleared list it sent. The save rebuilds the stored list from it and the delta, then merges that against the force the player has once the data is applied, as it did before #997. Nothing extra goes over RCON. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4a2c164188
commit
b0fb43d678
2 files changed
+68
-59
No files matched your search
@@ -256,7 +256,9 @@ function player_sync.deserialize_player(player, finished_record)
|
||||
-- An earlier raise not removed yet is replaced, the character's inventory bonus is restored with the data
|
||||
script_data.inventory_bonus_raises[player.name] = nil
|
||||
local failed, spill, inventory_bonus_raise =
|
||||
serialize.deserialize_player(player, serialized_player, finished_record.components, local_controller)
|
||||
serialize.deserialize_player(
|
||||
player, serialized_player, finished_record.components, local_controller, finished_record.recipe_notifications
|
||||
)
|
||||
script_data.failed_deserialization[player.name] = failed
|
||||
player_record.local_controller = nil
|
||||
if inventory_bonus_raise and inventory_bonus_raise > 0 then
|
||||
@@ -741,6 +743,8 @@ function player_sync.initiate_inventory_download(player, player_record, generati
|
||||
recipe_notifications = serialize.serialize_crafting_notifications(player)
|
||||
end
|
||||
|
||||
-- Kept to rebuild the stored list from the delta once the player's force is restored
|
||||
record.recipe_notifications = recipe_notifications
|
||||
clusterio_api.send_json("player_sync_download", {
|
||||
player_name = player.name,
|
||||
recipe_notifications = recipe_notifications,
|
||||
|
||||
Reference in new issue
Block a user