feat: stald-silo som mål, retfærdig fordeling, ADSettings + spuSet (v1.62.139)

This commit is contained in:
2026-10-10 02:36:37 +02:00
parent e8b362dc38
commit efc8463d6d
8 changed files with 246 additions and 9 deletions
+5 -1
View File
@@ -344,9 +344,12 @@ function ADRunsController.getTargetFillTypes(adEnv, run, vehicle)
stations = getTargetStations(adEnv, run, farmId)
end
local result, seen = {}, {}
-- stald-silo som mål (brugerønske 10/10): kun det foder, staldene ved siloen bruger — ikke alt siloen kan rumme
local stableOnly = ADSmartPickup.getStableSiloFillTypes ~= nil and ADSmartPickup.getStableSiloFillTypes(adEnv, stations, farmId) or nil
for _, fillType in ipairs(ADRunsController.getCarriableFillTypes(adEnv, vehicle)) do
for _, entry in ipairs(stations) do
if not seen[fillType] and ADSmartPickup.getStationLevelAndCapacity(entry.station, fillType, farmId) ~= nil then
if not seen[fillType] and (stableOnly == nil or stableOnly[fillType])
and ADSmartPickup.getStationLevelAndCapacity(entry.station, fillType, farmId) ~= nil then
seen[fillType] = true
table.insert(result, fillType)
end
@@ -1579,6 +1582,7 @@ end
-- Køretøjs-referencer der ikke findes (solgt, andet savegame) logges; run'et beholdes.
function ADRunsController.load(adEnv)
if ADSettings ~= nil then pcall(ADSettings.load) end
local ok, store = pcall(ADRunsStorage.load)
if not ok then
Logging.warning(ADRunsController.LOG_PREFIX .. "kunne ikke indlæse runs: %s", tostring(store))