feat: traktoren kører til egen parkering efter manuel afkobling (v1.62.38)

This commit is contained in:
2026-10-06 12:18:04 +02:00
parent 804dc17901
commit f2c77fd779
3 changed files with 14 additions and 1 deletions
+12
View File
@@ -535,6 +535,18 @@ local function finish(vehicle, job, ok, detail, adEnv)
-- spillerens egen tur til Connect: lad fx flowet starte traktoren bagefter
local okHook, err = pcall(ADHitch.onManualAttach, adEnv, vehicle, detail)
if not okHook then Logging.warning(ADHitch.LOG_PREFIX .. "efter manuel kobling: %s", tostring(err)) end
elseif ok and job.action == "detach" and #ADHitch.rearImplementsOf(vehicle) == 0 then
-- spillerens egen tur til redskabets parkering: traktoren skal ikke blive holdende ved redskabet (brugerønske 6/10)
local home = parkIdOf(adEnv, vehicle)
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
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
Logging.warning(ADHitch.LOG_PREFIX .. "'%s' kunne ikke sendes til sin parkering: %s", vehicleName(vehicle), tostring(errHome))
end
end
end
end