fix: fast ved Connect efter bak-stik afslutter turen normalt, så traktoren bakker det sidste (v1.62.34)
This commit is contained in:
@@ -142,7 +142,13 @@ function ADHitch.step(job, state, dt, succeeded)
|
||||
if state.atLastWaypoint and state.speed <= ADHitch.STILL_SPEED and state.distance <= arriveDistanceOf(state) then
|
||||
job.stuckMs = (job.stuckMs or 0) + dt
|
||||
if job.stuckMs >= ADHitch.STUCK_ARRIVE_MS then
|
||||
job.state, job.stopAd = "acting", true
|
||||
-- kobl på: første gang afsluttes AD's tur normalt, så bakningen de sidste meter (ADHitchCreep) kører
|
||||
-- (in-game 6/10: bakket ind via bak-stik så AD's sensor vognen og holdt 4 m før -> 'noAttachable')
|
||||
if job.action == "attach" and not job.endedTask then
|
||||
job.endTask, job.endedTask, job.stuckMs = true, true, 0
|
||||
else
|
||||
job.state, job.stopAd = "acting", true
|
||||
end
|
||||
end
|
||||
else
|
||||
job.stuckMs = 0
|
||||
@@ -554,6 +560,17 @@ function ADHitch.tick(adEnv, dt)
|
||||
local state = vehicleState(adEnv, vehicle, job.markerId)
|
||||
state.arriveDistance = ADHitch.arriveDistanceFor(job.action, job.crept)
|
||||
ADHitch.step(job, state, elapsed, succeeded)
|
||||
if job.endTask then
|
||||
job.endTask = nil
|
||||
local taskModule = vehicle.ad ~= nil and vehicle.ad.taskModule or nil
|
||||
local ok = taskModule ~= nil and taskModule.getActiveTask ~= nil and taskModule:getActiveTask() ~= nil
|
||||
and pcall(taskModule.setCurrentTaskFinished, taskModule)
|
||||
if ok then
|
||||
Logging.info(ADHitch.LOG_PREFIX .. "'%s' holdt stille ved sidste waypoint %.1f m fra '%s' — afslutter turen, bakker det sidste stykke", vehicleName(vehicle), state.distance, tostring(job.markerName))
|
||||
else
|
||||
job.state, job.stopAd = "acting", true
|
||||
end
|
||||
end
|
||||
if job.stopAd then
|
||||
job.stopAd = nil
|
||||
if vehicle.stopAutoDrive ~= nil then pcall(vehicle.stopAutoDrive, vehicle) end
|
||||
|
||||
Reference in New Issue
Block a user