chore: diagnose af kædens behov ved for få marker (v1.62.107)

This commit is contained in:
2026-10-08 20:24:32 +02:00
parent 20f7d1a410
commit b249371e7c
3 changed files with 14 additions and 1 deletions
+12
View File
@@ -465,6 +465,18 @@ function ADChain.notifyUncovered(last)
count = count + 1
local text = ADChain.uncoveredText(entry, last.titles, textOf)
Logging.info(ADChain.LOG_PREFIX .. "ikke marker nok: %s", text)
-- diagnose: hvem kræver varen (rødder med cyklusser), og hvad æder dyrene
pcall(function()
local parts = {}
for _, root in ipairs(last.chain.roots or {}) do
table.insert(parts, string.format("%s %.0f cykl.", tostring(root.key), root.cycles or -1))
end
local animals = {}
for name, perMonth in pairs((last.data or {}).animalDemand or {}) do table.insert(animals, string.format("%s %.0f", name, perMonth)) end
Logging.info(ADChain.LOG_PREFIX .. " diagnose %s: behov %.0f l/md, lager %.0f l | rødder: %s | dyr: %s", tostring(entry.key),
(last.chain.fieldDemand or {})[entry.key] or (last.chain.fieldDemand or {})[entry.fruit] or 0,
((last.data or {}).stock or {})[entry.key] or 0, table.concat(parts, ", "), table.concat(animals, ", "))
end)
if ADFieldJobs ~= nil and ADFieldJobs.notify ~= nil then ADFieldJobs.notify(text, true) end
end
end