fix(ad): skub også når AD stopper vognen lige før aflæsningsmålet (v1.62.275)

This commit is contained in:
2026-10-16 18:01:18 +02:00
parent e47a95b411
commit c63780e967
3 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -11,6 +11,7 @@ ADUnloadKick.MAX_KICKS = 2 -- skub pr. vindue
ADUnloadKick.WINDOW_MS = 10 * 60 * 1000
ADUnloadKick.STILL_SPEED = 0.00028 -- som AD's egen stoppedTimer (m/ms)
ADUnloadKick.UNLOAD_TASK = "UnloadAtDestinationTask"
ADUnloadKick.NEAR_END_WP = 2 -- AD-stoppet så mange vejpunkter før enden tæller som ved målet
local watch = setmetatable({}, {__mode = "k"}) -- [vehicle] = {stillMs, startFill}
local kicks = setmetatable({}, {__mode = "k"}) -- [vehicle] = {times...}
@@ -48,9 +49,13 @@ end
local function stateOf(vehicle)
local ad = vehicle.ad
local task = ad.taskModule ~= nil and ad.taskModule.activeTask or nil
local dpm, cdm = ad.drivePathModule, ad.collisionDetectionModule
local dpm, cdm, sdm = ad.drivePathModule, ad.collisionDetectionModule, ad.specialDrivingModule
local wayPoints, current = nil, nil
if dpm ~= nil and dpm.getWayPoints ~= nil then wayPoints, current = dpm:getWayPoints() end
-- AD stopper selv vognen inden sidste punkt, når triggeren er inden for rækkevidde (in-game 16/10: 'Slurry'
-- holdt 820 s ved wp 2/3 med "stopper=true") — det tæller som ved målet
local stopping = sdm ~= nil and sdm.isStoppingVehicle ~= nil and sdm:isStoppingVehicle() == true
local count = wayPoints ~= nil and #wayPoints or 0
-- Smart Pickup holder den selv (Wait-punkt / udkørsel venter på plads): ikke et skub
local held = (ADUnloadWait ~= nil and ADUnloadWait.getWaitFor ~= nil and ADUnloadWait.getWaitFor(vehicle) ~= nil)
or (ADOutbound ~= nil and ADOutbound.getHoldFor ~= nil and ADOutbound.getHoldFor(vehicle) ~= nil)
@@ -62,7 +67,7 @@ local function stateOf(vehicle)
-- AD venter selv på AutoLoad-/balleaflæsning
alWait = task ~= nil and task.state ~= nil and task.state == 3,
unloading = task ~= nil and task.taskType == ADUnloadKick.UNLOAD_TASK,
atEnd = wayPoints ~= nil and current ~= nil and #wayPoints > 0 and current >= #wayPoints,
atEnd = current ~= nil and count > 0 and (current >= count or (stopping and current >= count - ADUnloadKick.NEAR_END_WP)),
paused = dpm ~= nil and dpm.isPaused == true,
obstacle = cdm ~= nil and cdm.detectedObstable == true,
traffic = cdm ~= nil and cdm.trafficVehicle ~= nil,
+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.274.0</version>
<version>1.62.275.0</version>
<title>
<en>AD Smart Pickup</en>
</title>