fix: bak fri af frontredskab ved alle Kør til-ture, også Stop alt og parkér (v1.62.77)

This commit is contained in:
2026-10-08 09:37:26 +02:00
parent 9cb8bdd075
commit 1c33977ce8
4 changed files with 7 additions and 10 deletions
+5
View File
@@ -129,6 +129,11 @@ local function startAd(adEnv, vehicle, mode, firstId, secondId, fillType)
vehicle:startAutoDrive()
end
wake(vehicle, true)
-- "Kør til" med et løst frontredskab lige foran (fx lige sat af ved "P Front Mower"): bak fri først (8/10)
if mode == adEnv.AutoDrive.MODE_DRIVETO and ADHitchCreep ~= nil and ADHitchCreep.backOffIfBlocked ~= nil then
local ok, err = pcall(ADHitchCreep.backOffIfBlocked, adEnv, vehicle)
if not ok then Logging.warning("ADSmartPickup: bak fri af frontredskab: %s", tostring(err)) end
end
end
ADFieldWork.startAd = startAd
-9
View File
@@ -467,13 +467,6 @@ 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)
@@ -481,7 +474,6 @@ 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
@@ -651,7 +643,6 @@ 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
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.62.76.0</version>
<version>1.62.77.0</version>
<title>
<en>AD Smart Pickup</en>
</title>