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
+6 -1
View File
@@ -154,6 +154,11 @@ local function readBarnFood(data, placeable, nameOf)
local barnName
for index, perDay in pairs(ADSources.getHusbandryConsumption(placeable) or {}) do
local name = nameOf(index)
-- dyrenes forbrug er et behov i kæden (brugerønske 8/10: frie marker lægges om til det dyrene mangler).
-- Samme enhed som fabrikkernes cyklusser pr. måned (spillets rå rate pr. 24-timers dag). Vand dyrkes ikke.
if name ~= nil and name ~= "WATER" and (perDay or 0) > 0 and data.animalDemand ~= nil then
data.animalDemand[name] = (data.animalDemand[name] or 0) + perDay
end
if name ~= nil and (perDay or 0) > 0 then
barnName = barnName or placeableName(placeable, placeableId(placeable) or "?")
data.barnFood[name] = data.barnFood[name] or {}
@@ -564,7 +569,7 @@ end
-- ikke har nået alle marker.
function ADChainData.collect(adEnv, farmId, byChain)
local data = {recipes = {}, husbandry = {}, crops = {}, stock = {}, fields = {}, yields = {}, fruitFillIndex = {},
usedFruits = {}, points = {}, fillTitles = {}, fillIndex = {}, placeables = {}, barnFood = {}, barnAccepts = {}, stockByFill = {}, rates = {}, fieldGoods = {}, fieldGoodCrops = {}, unswitchable = {}, harvesting = {}}
usedFruits = {}, points = {}, fillTitles = {}, fillIndex = {}, placeables = {}, barnFood = {}, barnAccepts = {}, animalDemand = {}, stockByFill = {}, rates = {}, fieldGoods = {}, fieldGoodCrops = {}, unswitchable = {}, harvesting = {}}
local nameOf = nameResolver(data)
data.priceOf = priceResolver(data)
readPlaceables(data, farmId, byChain, nameOf)