fix: ledige flow-traktorer startes, Wait prøver andre mål, staldkobling uden servicemarkører (1.62.235)
This commit is contained in:
@@ -175,6 +175,15 @@ function ADUnloadWait.isStaleDestination(taskDestination, targetId, hasMarkerAtD
|
||||
end
|
||||
|
||||
-- Er ventetiden ved Wait udløbet? minutes = 0 slår reglen fra.
|
||||
-- Ventende vogn: værd at forlade Wait for et af run'ets andre mål? Det andet mål skal kunne tage hele resten eller
|
||||
-- mindst MIN_FREE_TO_LEAVE_WAIT, og have mere plads end hjemmet (ellers kører den frem og tilbage for småportioner).
|
||||
ADUnloadWait.MIN_FREE_TO_LEAVE_WAIT = 20000
|
||||
ADUnloadWait.OTHER_TARGET_CHECK_MS = 30000
|
||||
function ADUnloadWait.isWorthLeavingWait(otherFree, homeFree, rest)
|
||||
if otherFree == nil or rest == nil or rest <= 0 then return false end
|
||||
return otherFree >= math.min(rest, ADUnloadWait.MIN_FREE_TO_LEAVE_WAIT) and otherFree > (homeFree or 0)
|
||||
end
|
||||
|
||||
function ADUnloadWait.waitHomeDue(waitedMs, minutes)
|
||||
local limit = tonumber(minutes) or 0
|
||||
return limit > 0 and (waitedMs or 0) >= limit * 60000
|
||||
@@ -319,6 +328,23 @@ local function updateWaiting(adEnv, task, wait, dt)
|
||||
local run = ADRunsController ~= nil and activeRunOf(vehicle) or nil
|
||||
local freeFraction = run ~= nil and run.returnBelowPercent ~= nil and (1 - run.returnBelowPercent / 100) or nil
|
||||
if free == nil or not ADSupplyPlanner.canUnloadRest(free, rest, capacity, freeFraction) then
|
||||
-- et af run'ets andre mål har plads: kør resten derhen i stedet for at vente på hjemmet (in-game 15/10:
|
||||
-- 941.000 l TMR ventede i timevis ved Farm Wait 1 på Kostald 1, mens Kostald 2 stod uden foder)
|
||||
wait.otherCheckMs = (wait.otherCheckMs or ADUnloadWait.OTHER_TARGET_CHECK_MS) + (dt or 0)
|
||||
if wait.otherCheckMs >= ADUnloadWait.OTHER_TARGET_CHECK_MS then
|
||||
wait.otherCheckMs = 0
|
||||
local other, otherFree = findOtherTargetForRest(adEnv, vehicle, fillType, home)
|
||||
if other ~= nil and ADUnloadWait.isWorthLeavingWait(otherFree, free, rest) then
|
||||
release(vehicle)
|
||||
pendingTargetRestore[vehicle] = nil
|
||||
vehicle.ad.stateModule:setSecondMarkerByWayPointId(other.id)
|
||||
redirect(task, other.id)
|
||||
Logging.info(ADUnloadWait.LOG_PREFIX .. "'%s' forlader %s — resten (%.0f l %s) køres til %s (%.0f l fri)", tostring(ADRuns.vehicleLabel(vehicle)),
|
||||
tostring(wait.waitMarker.name), rest, g_fillTypeManager ~= nil and tostring(g_fillTypeManager:getFillTypeNameByIndex(fillType)) or tostring(fillType),
|
||||
tostring(other.name), otherFree)
|
||||
return
|
||||
end
|
||||
end
|
||||
if ADLoadSwap ~= nil then
|
||||
local isReachable = function(markerId)
|
||||
return hasRouteTo(adEnv, vehicle, markerId)
|
||||
|
||||
Reference in New Issue
Block a user