fix: bak fri af løst frontredskab før AD-turen starter (v1.62.76)
This commit is contained in:
@@ -467,6 +467,13 @@ function ADHitch.tryDetach(vehicle, job)
|
||||
return false, "stillAttached: " .. table.concat(names, ", ")
|
||||
end
|
||||
|
||||
-- Frontredskab lige sat af: bak fri, før AD kører (ADHitchCreep, in-game 8/10 "P Front Mower").
|
||||
local function backOffIfBlocked(adEnv, vehicle)
|
||||
if ADHitchCreep == nil or ADHitchCreep.backOffIfBlocked == nil then return end
|
||||
local ok, err = pcall(ADHitchCreep.backOffIfBlocked, adEnv, vehicle)
|
||||
if not ok then Logging.warning(ADHitch.LOG_PREFIX .. "bak fri af frontredskab: %s", tostring(err)) end
|
||||
end
|
||||
|
||||
local function start(adEnv, vehicle, markerId, action, onDone)
|
||||
local marker = adEnv.ADGraphManager:getMapMarkerByWayPointId(markerId)
|
||||
local job = ADHitch.newJob(markerId, marker ~= nil and marker.name or tostring(markerId), action)
|
||||
@@ -474,6 +481,7 @@ local function start(adEnv, vehicle, markerId, action, onDone)
|
||||
jobs[vehicle] = job
|
||||
ADFieldWork.startAd(adEnv, vehicle, adEnv.AutoDrive.MODE_DRIVETO, markerId)
|
||||
Logging.info(ADHitch.LOG_PREFIX .. "'%s' kører til '%s'", vehicleName(vehicle), job.markerName)
|
||||
backOffIfBlocked(adEnv, vehicle)
|
||||
return job
|
||||
end
|
||||
|
||||
@@ -643,6 +651,7 @@ local function finish(vehicle, job, ok, detail, adEnv)
|
||||
if home ~= nil and home ~= job.markerId and ADFieldWork ~= nil and ADFieldWork.startAd ~= nil then
|
||||
local okHome, errHome = pcall(ADFieldWork.startAd, adEnv, vehicle, adEnv.AutoDrive.MODE_DRIVETO, home)
|
||||
if okHome then
|
||||
backOffIfBlocked(adEnv, vehicle)
|
||||
local marker = adEnv.ADGraphManager:getMapMarkerByWayPointId(home)
|
||||
Logging.info(ADHitch.LOG_PREFIX .. "'%s' kører til sin egen parkering '%s'", vehicleName(vehicle), tostring(marker ~= nil and marker.name or home))
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user