fix: alt foder staldene kan æde tæller som brugt på gården (v1.62.54)
This commit is contained in:
@@ -186,6 +186,8 @@ end
|
||||
function ADChainActions.farmUses(data, runs)
|
||||
local uses = {}
|
||||
for name in pairs((data or {}).barnFood or {}) do uses[name] = true end
|
||||
-- alt foder staldene kan æde (også med tomt trug): sælges ikke straks
|
||||
for name in pairs((data or {}).barnAccepts or {}) do uses[name] = true end
|
||||
for name, rate in pairs((data or {}).rates or {}) do
|
||||
if (rate.consumption or 0) > 0 then uses[name] = true end
|
||||
end
|
||||
|
||||
@@ -144,6 +144,12 @@ end
|
||||
|
||||
-- Stald-foder: {[vare] = {staldnavn...}} for det truget æder nu (forbrug > 0) — til afhængighedstjekket.
|
||||
local function readBarnFood(data, placeable, nameOf)
|
||||
if ADSources.getHusbandryAcceptedFoods ~= nil then
|
||||
for index in pairs(ADSources.getHusbandryAcceptedFoods(placeable) or {}) do
|
||||
local name = nameOf(index)
|
||||
if name ~= nil then data.barnAccepts[name] = true end
|
||||
end
|
||||
end
|
||||
if ADSources.getHusbandryConsumption == nil then return end
|
||||
local barnName
|
||||
for index, perDay in pairs(ADSources.getHusbandryConsumption(placeable) or {}) do
|
||||
@@ -558,7 +564,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 = {}, stockByFill = {}, rates = {}, fieldGoods = {}, fieldGoodCrops = {}, unswitchable = {}, harvesting = {}}
|
||||
usedFruits = {}, points = {}, fillTitles = {}, fillIndex = {}, placeables = {}, barnFood = {}, barnAccepts = {}, stockByFill = {}, rates = {}, fieldGoods = {}, fieldGoodCrops = {}, unswitchable = {}, harvesting = {}}
|
||||
local nameOf = nameResolver(data)
|
||||
data.priceOf = priceResolver(data)
|
||||
readPlaceables(data, farmId, byChain, nameOf)
|
||||
|
||||
@@ -1007,6 +1007,18 @@ function ADSources.getHusbandryConsumption(placeable)
|
||||
return result
|
||||
end
|
||||
|
||||
-- Foder stalden KAN æde (trugets varer), uanset om truget er tomt lige nu: {[fillType] = true}. Kun stalde med dyr.
|
||||
-- Et tomt trug giver intet forbrug, og så blev TMR'en solgt før køerne nogensinde fik den (in-game 6/10).
|
||||
function ADSources.getHusbandryAcceptedFoods(placeable)
|
||||
local result = {}
|
||||
local food = placeable ~= nil and placeable.spec_husbandryFood or nil
|
||||
if food == nil or type(food.fillLevels) ~= "table" then return result end
|
||||
local okCount, count = pcall(function() return placeable.getNumOfAnimals ~= nil and placeable:getNumOfAnimals() or 1 end)
|
||||
if okCount and type(count) == "number" and count <= 0 then return result end
|
||||
for fillType in pairs(food.fillLevels) do result[fillType] = true end
|
||||
return result
|
||||
end
|
||||
|
||||
-- Én stalds produktion (mælk, gødning, ...): {[fillType] = liter} kun for production > 0. Spillets rå rate
|
||||
-- (pr. måned = én 24-timers dag) UDEN timeAdjustment — samme enhed som fabrikkernes cyklusser pr. måned i kæden.
|
||||
function ADSources.getHusbandryOutputs(placeable)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.53.0</version>
|
||||
<version>1.62.54.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user