mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 00:23:12 +09:00
Fix failed not being cleared
This commit is contained in:
1 file changed
+4
-2
@@ -557,6 +557,7 @@ function serialize.deserialize_crafting_notifications(player, serialized, previo
|
|||||||
--- @type CraftingNotificationDelta
|
--- @type CraftingNotificationDelta
|
||||||
local delta = helpers.json_to_table(assert(helpers.decode_string(serialized)))
|
local delta = helpers.json_to_table(assert(helpers.decode_string(serialized)))
|
||||||
assert(type(delta) == "table", "wrong type decoded from json_to_table")
|
assert(type(delta) == "table", "wrong type decoded from json_to_table")
|
||||||
|
|
||||||
local failed = {}
|
local failed = {}
|
||||||
for _, recipe_name in pairs(previous_failed or {}) do
|
for _, recipe_name in pairs(previous_failed or {}) do
|
||||||
failed[recipe_name] = true
|
failed[recipe_name] = true
|
||||||
@@ -567,10 +568,11 @@ function serialize.deserialize_crafting_notifications(player, serialized, previo
|
|||||||
for _, recipe in pairs(player.force.recipes) do
|
for _, recipe in pairs(player.force.recipes) do
|
||||||
if recipe.enabled and not recipe.hidden then
|
if recipe.enabled and not recipe.hidden then
|
||||||
enabled[recipe.name] = true
|
enabled[recipe.name] = true
|
||||||
|
failed[recipe.name] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Clear notifications the player has cleared elsewhere
|
-- Clear notifications the player has cleared elsewhere, this means "add seen notification"
|
||||||
for _, recipe_name in pairs(delta.add or {}) do
|
for _, recipe_name in pairs(delta.add or {}) do
|
||||||
if enabled[recipe_name] then
|
if enabled[recipe_name] then
|
||||||
player.clear_recipe_notification(recipe_name)
|
player.clear_recipe_notification(recipe_name)
|
||||||
@@ -579,7 +581,7 @@ function serialize.deserialize_crafting_notifications(player, serialized, previo
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Add notifications the player has elsewhere
|
-- Add notifications the player has elsewhere, this means "remove seen notification"
|
||||||
for _, recipe_name in pairs(delta.remove or {}) do
|
for _, recipe_name in pairs(delta.remove or {}) do
|
||||||
if enabled[recipe_name] then
|
if enabled[recipe_name] then
|
||||||
player.add_recipe_notification(recipe_name)
|
player.add_recipe_notification(recipe_name)
|
||||||
|
|||||||
Reference in new issue
Block a user