feat: dyrenes foderforbrug som kædebehov — frie marker lægges om til det dyrene mangler (v1.62.95)

This commit is contained in:
2026-10-08 19:38:19 +02:00
parent 20d86fc0b2
commit 9924e11278
7 changed files with 21 additions and 7 deletions
+3 -3
View File
@@ -308,11 +308,11 @@ end
local function plan(data, state)
local recipes = ADChain.modelRecipes(data.recipes, state.paused, state.userOff, state.optIn)
local chain = ADChainModel.build(recipes, data.husbandry, data.crops, data.fieldGoods, data.fieldGoodCrops)
local chain = ADChainModel.build(recipes, data.husbandry, data.crops, data.fieldGoods, data.fieldGoodCrops, data.animalDemand)
-- pausede rødder: det de bruger, er beskyttet mod slukning (modellen regnet som om de ikke var pauset)
local protected = {}
if next(state.paused) ~= nil then
protected = ADChainModel.build(ADChain.modelRecipes(data.recipes, {}, state.userOff, state.optIn), data.husbandry, data.crops, data.fieldGoods, data.fieldGoodCrops).needRecipes
protected = ADChainModel.build(ADChain.modelRecipes(data.recipes, {}, state.userOff, state.optIn), data.husbandry, data.crops, data.fieldGoods, data.fieldGoodCrops, data.animalDemand).needRecipes
end
local used = ADChain.unionFruits(data.usedFruits, chain.fieldDemand, chain.fieldProducts)
-- ufuldstændig markliste: udbuddet ville være undervurderet -> ingen mangler, forslag eller markskift endnu
@@ -426,7 +426,7 @@ function ADChain.notifyProblems(last)
if #fresh == 0 or ADFieldJobs == nil or ADFieldJobs.notify == nil then return 0 end
local textOf = function(key) return g_i18n ~= nil and g_i18n:getText(key) or key end
local fmt = SmartPickupFrame ~= nil and SmartPickupFrame.formatCompact or nil
local rootNames = {}
local rootNames = {animals = textOf("spu_chain_animals")}
for _, root in ipairs(last.chain ~= nil and last.chain.roots or {}) do
rootNames[root.key] = tostring((last.titles or {})[root.name] or root.name)
end