feat(kobling): spillerens AD 'Kør til' til et puljeredskabs egen parkering kobler det af (flow-vogne og puljeredskaber; faste sæt røres ikke) (v1.56.3.0)

This commit is contained in:
2026-09-29 15:01:36 +02:00
parent fece920028
commit 3d6a3761e5
3 changed files with 20 additions and 2 deletions
+15 -1
View File
@@ -71,6 +71,13 @@ function ADHitch.stepAction(name)
return ADHitch.parseMarker(name) or "arrive"
end
-- Spillerens egen AD "Kør til": markørens navn (Connect/Afkobl) først, ellers er puljeredskabets egen parkering
-- stedet vognen sættes af. -> "attach" | "detach" | nil
function ADHitch.manualAction(parsedAction, isPoolImplementPark)
if parsedAction ~= nil then return parsedAction end
return isPoolImplementPark and "detach" or nil
end
-- I en tur: en almindelig markør, der er AD-parkeringen for redskabet bag traktoren, er stedet vognen sættes af.
function ADHitch.resolveAction(action, isImplementPark)
if action == "arrive" and isImplementPark then return "detach" end
@@ -464,7 +471,14 @@ local function watchManualTrips(adEnv)
if jobs[vehicle] == nil and vehicle.spec_attacherJoints ~= nil and module ~= nil and module:isActive()
and module:getMode() == adEnv.AutoDrive.MODE_DRIVETO then
local marker = module:getFirstMarker()
local action = marker ~= nil and ADHitch.parseMarker(marker.name) or nil
local action = nil
if marker ~= nil then
local isPoolPark = false
for _, parkId in ipairs(ADHitch.poolParkIds(adEnv, vehicle)) do
if parkId == marker.id then isPoolPark = true end
end
action = ADHitch.manualAction(ADHitch.parseMarker(marker.name), isPoolPark)
end
if action ~= nil then jobs[vehicle] = ADHitch.newJob(marker.id, marker.name, action) end
end
end
+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.56.2.0</version>
<version>1.56.3.0</version>
<title>
<en>AD Smart Pickup</en>
</title>
+4
View File
@@ -121,5 +121,9 @@ check("transport: allerede klar", #H.stowActions({}), 0)
check("transport: kan ikke foldes -> kun sluk/løft", table.concat(H.stowActions({turnedOn = true, lowered = true, unfolded = true, canFold = false}), ","), "turnOff,raise")
check("transport: kun udfoldet", table.concat(H.stowActions({unfolded = true, canFold = true}), ","), "fold")
check("vagt: stoppedAway med afstand", H.step(H.newJob(1, "Connect x", "attach"), {adActive = false, distance = 37.4, speed = 0}, 4000, false).reason, "stoppedAway (37 m fra markøren)")
-- manuel AD "Kør til": markørnavn først, ellers puljeredskabets egen parkering = kobl af (fast sæt røres ikke)
check("manuel: Connect-markør", H.manualAction("attach", false), "attach")
check("manuel: puljeredskabets parkering", H.manualAction(nil, true), "detach")
check("manuel: almindelig markør", H.manualAction(nil, false), nil)
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)