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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user