fix: kodegennemgang — parkeringsvagt-billede, bak-fri ved hentning, kurve-passage (v1.62.89)

This commit is contained in:
2026-10-08 11:39:01 +02:00
parent 14cb2990cb
commit 94551dab8e
4 changed files with 18 additions and 5 deletions
+9 -3
View File
@@ -463,10 +463,14 @@ function ReverseOutTask:update(dt)
local _, _, lz = worldToLocal(vehicle.rootNode, wp.x, p.y, wp.z)
local distance = math.sqrt((p.x - wp.x) ^ 2 + (p.z - wp.z) ^ 2)
-- nået: tæt nok på, eller kørt forbi (vejpunktet ligger nu foran traktoren, når den bakker)
local action = ADHitchCreep.reverseOutStep({reached = distance <= ADHitchCreep.REVERSE_OUT_REACHED_M or lz > 0.5,
-- kørt forbi: vejpunktet ligger foran OG afstanden vokser igen (i en skarp kurve kan et punkt ligge foran/ved
-- siden, før det er nået — kodegennemgang 8/10)
local passed = lz > 0.5 and self.lastDistance ~= nil and distance > self.lastDistance + 0.05
self.lastDistance = distance
local action = ADHitchCreep.reverseOutStep({reached = distance <= ADHitchCreep.REVERSE_OUT_REACHED_M or passed,
last = self.index >= #self.path, elapsedMs = self.elapsedMs, stillMs = self.stillMs})
if action == "next" then
self.index = self.index + 1
self.index, self.lastDistance = self.index + 1, nil
return
elseif action ~= "drive" then
return self:finish(action)
@@ -524,7 +528,9 @@ function ADHitchCreep.backOffIfBlocked(adEnv, vehicle)
if taskModule == nil or taskModule.tasks == nil then return false end
-- blindgyde-bås: bak ud ad dens bakkekanter (det klarer også et frontredskab lige foran)
local path = reverseOutPathFor(adEnv, vehicle)
local implement = #path == 0 and blockingFrontImplement(vehicle) or nil
-- på vej for at koble på: redskabet foran er netop målet — ikke bak fra det (kodegennemgang 8/10)
local fetching = ADHitch ~= nil and ADHitch.pendingAttach ~= nil and ADHitch.pendingAttach(vehicle) ~= nil
local implement = #path == 0 and not fetching and blockingFrontImplement(vehicle) or nil
if #path == 0 and implement == nil then return false end
if taskModule:getActiveTask() ~= nil then
Logging.warning(ADHitchCreep.LOG_PREFIX .. "'%s' skal bakke ud først, men AD kører allerede", vehicleName(vehicle))
+7 -1
View File
@@ -96,6 +96,10 @@ local function refresh(graph, only)
for _, entry in ipairs(list) do if only[entry.key] then table.insert(filtered, entry) end end
list = filtered
end
if only == nil then
-- helt nyt billede: køretøjer hvis parkering er slettet/ugyldig må ikke beholde et gammelt navn
for key in pairs(snapshot) do snapshot[key] = nil end
end
for key, name in pairs(ADParkGuard.capture(list, nameOf)) do snapshot[key] = name end
end
@@ -120,7 +124,9 @@ function ADParkGuard.install(adEnv)
local result = originalSet(vehicle, ...)
pcall(function()
local units = {}
for _, unit in ipairs(autoDrive.getAllUnits ~= nil and autoDrive.getAllUnits(vehicle) or {vehicle}) do units[unit] = true end
-- AD sætter parkeringen på det valgte redskab (getSelectedWorkTool) — alle redskaber og vogne tages med
for _, unit in ipairs(autoDrive.getAllUnits ~= nil and autoDrive.getAllUnits(vehicle) or {}) do units[unit] = true end
for _, unit in ipairs(autoDrive.getAllImplements ~= nil and autoDrive.getAllImplements(vehicle, true) or {}) do units[unit] = true end
units[vehicle] = true
for unit in pairs(units) do snapshot[unit] = nil end
refresh(graph, units)
+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.88.0</version>
<version>1.62.89.0</version>
<title>
<en>AD Smart Pickup</en>
</title>