fix(kæde): spillerens slukninger huskes, pause beskytter kun sin egen kæde, stoppede flows slippes og forældede nøgler glemmes

This commit is contained in:
2026-09-30 14:24:16 +02:00
parent 9c9c2badeb
commit 605c4e8d45
5 changed files with 131 additions and 37 deletions
+4 -2
View File
@@ -2,12 +2,14 @@
ADChainActions = {}
function ADChainActions.productions(recipes, needRecipes, anyPaused)
-- protected = {[nøgle] = cyklusser}: behov fra pausede rødder — slukkes ikke, men tændes heller ikke.
function ADChainActions.productions(recipes, needRecipes, protected)
local result = {enable = {}, disable = {}}
for _, recipe in ipairs(recipes or {}) do
local needed = ((needRecipes or {})[recipe.key] or 0) > 0
local kept = ((protected or {})[recipe.key] or 0) > 0
if needed and not recipe.enabled then table.insert(result.enable, recipe.key) end
if not needed and recipe.enabled and recipe.byChain and not anyPaused then table.insert(result.disable, recipe.key) end
if not needed and not kept and recipe.enabled and recipe.byChain then table.insert(result.disable, recipe.key) end
end
table.sort(result.enable); table.sort(result.disable)
return result