fix: AutoDrive tælles ikke som Courseplay (flow-traktor med AD aktiv ventede på sig selv ved Start efter indlæsning); venteårsag logges kun ved ændring (v1.57.4.0)
This commit is contained in:
@@ -146,6 +146,7 @@ local fetching = setmetatable({}, {__mode = "k"}) -- traktor -> runId (henter s
|
||||
local emptying = setmetatable({}, {__mode = "k"}) -- traktor -> {stage, since, fillType, runName}
|
||||
local homing = setmetatable({}, {__mode = "k"}) -- traktor -> true (flowets hjemtur: vogn af, traktor hjem)
|
||||
local fetchRetries = setmetatable({}, {__mode = "k"}) -- traktor -> antal nye hente-forsøg
|
||||
local lastWaitText = setmetatable({}, {__mode = "k"}) -- traktor -> sidst loggede venteårsag (kun ændringer logges)
|
||||
local missingCount = {} -- runId -> tjek i træk
|
||||
local seenBuildings = {} -- bygnings-id'er set i denne session
|
||||
local rememberTimer, buildingTimer = 0, 0
|
||||
@@ -296,20 +297,22 @@ function ADFlowWagons.beforeStart(adEnv, run, vehicle)
|
||||
wagonBusy = wagonId ~= nil and ADPool.isReserved(wagonId),
|
||||
}
|
||||
local action = ADFlowWagons.startAction(startState)
|
||||
if action == "start" then return false end
|
||||
if action == "start" then lastWaitText[vehicle] = nil return false end
|
||||
ADRunsController.runningRuns[run.id] = true
|
||||
if action == "wait" then
|
||||
if waiting[vehicle] == nil then
|
||||
local holder = wagon ~= nil and wagon.getAttacherVehicle ~= nil and wagon:getAttacherVehicle() or nil
|
||||
Logging.info(ADFlowWagons.LOG_PREFIX .. "flow '%s': '%s' venter på sin vogn (%s: %s)", tostring(run.name),
|
||||
tostring(ADRuns.vehicleLabel(vehicle)), ADFlowWagons.waitReason(startState),
|
||||
startState.tractorBusy and ADFlowWagons.busyWhy(vehicle, tractorId)
|
||||
or (holder ~= nil and ("sidder på " .. tostring(ADRuns.vehicleLabel(holder)))) or "reserveret af puljen")
|
||||
local holder = wagon ~= nil and wagon.getAttacherVehicle ~= nil and wagon:getAttacherVehicle() or nil
|
||||
local waitText = ADFlowWagons.waitReason(startState) .. ": " .. (startState.tractorBusy and ADFlowWagons.busyWhy(vehicle, tractorId)
|
||||
or (holder ~= nil and ("sidder på " .. tostring(ADRuns.vehicleLabel(holder)))) or "reserveret af puljen")
|
||||
if lastWaitText[vehicle] ~= waitText then
|
||||
lastWaitText[vehicle] = waitText
|
||||
Logging.info(ADFlowWagons.LOG_PREFIX .. "flow '%s': '%s' venter på sin vogn (%s)", tostring(run.name),
|
||||
tostring(ADRuns.vehicleLabel(vehicle)), waitText)
|
||||
end
|
||||
waiting[vehicle] = run.id
|
||||
return true, {vehicle = vehicle, ok = true, reason = "waitingWagon"}
|
||||
end
|
||||
waiting[vehicle] = nil
|
||||
lastWaitText[vehicle] = nil
|
||||
fetching[vehicle] = run.id
|
||||
local runId = run.id
|
||||
local okFetch, errFetch = pcall(ADHitch.fetch, adEnv, vehicle, connectId, function(tractor, ok, detail)
|
||||
|
||||
Reference in New Issue
Block a user