feat: indstillinger waitHomeMinutes + troughRefillPercent (v1.62.143)

This commit is contained in:
2026-10-10 03:42:04 +02:00
parent 00674277e6
commit 9fb6b97b52
11 changed files with 55 additions and 6 deletions
+7 -1
View File
@@ -786,11 +786,17 @@ local getTargetLevelAndCapacity = ADSmartPickup.getStationLevelAndCapacity
-- Niveau + kapacitet pr. ingrediens i aflæsningsmålets lager; demand giver forbrug/min.
local function getTargetNeeds(station, ingredients, farmId, demand)
local needs = {}
-- trug-tærskel pr. stald (ADSettings "troughRefillPercent"): kør først når truget er under tærsklen
local placeable = station ~= nil and station.owningPlaceable or nil
local buildingId = placeable ~= nil and ADBuildings ~= nil and ADBuildings.getId ~= nil and ADBuildings.getId(placeable) or nil
local threshold = ADSettings ~= nil and ADSettings.get("troughRefillPercent", buildingId) or 100
for _, fillType in ipairs(ingredients) do
local level, capacity = getTargetLevelAndCapacity(station, fillType, farmId)
if level ~= nil then
local troughScore, priority, troughCapacity = getFoodPriority(station, fillType)
table.insert(needs, {fillType = fillType, level = level, capacity = capacity, litersPerMinute = demand[fillType], scoreOverride = troughScore, priority = priority, troughCapacity = troughCapacity})
if troughScore == nil or ADSupplyPlanner.troughNeedsRefill(troughScore, threshold) then
table.insert(needs, {fillType = fillType, level = level, capacity = capacity, litersPerMinute = demand[fillType], scoreOverride = troughScore, priority = priority, troughCapacity = troughCapacity})
end
end
end
return needs