fix: skærebords-skiftets stifindermål får højde (AD DrivePathModule nil-fejl) — 1.62.156

This commit is contained in:
2026-10-10 05:58:40 +02:00
parent a2fee60349
commit b90cb60772
3 changed files with 10 additions and 1 deletions
+8
View File
@@ -218,6 +218,9 @@ local function pathTask(swap, reverse)
end
local target, vector = ADHeaderSwap.approachTarget(swap.combine, jointNode, input.node, reverse)
if target == nil then return finish(swap, false, "kunne ikke regne retningen ud") end
-- AD lægger målpunktet ind som rutens sidste vejpunkt og regner med højden (in-game 10/10: uden y fejlede
-- DrivePathModule:getApproachingHeightDiff i hver frame)
target.y = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, target.x, 1, target.z)
self.planning = true
local pathFinder = swap.combine.ad.pathFinderModule
pathFinder:reset()
@@ -234,6 +237,11 @@ local function pathTask(swap, reverse)
if ad.pathFinderModule:hasFinished() then
local path = ad.pathFinderModule:getPath()
if path == nil or #path == 0 then return finish(swap, false, "AD's stifinder fandt ingen vej på marken") end
for _, point in ipairs(path) do
if point.y == nil and point.x ~= nil and point.z ~= nil then
point.y = getTerrainHeightAtWorldPos(g_currentMission.terrainRootNode, point.x, 1, point.z)
end
end
Logging.info(ADHeaderSwap.LOG_PREFIX .. "'%s' kører %d vejpunkter", vehicleName(swap.combine), #path)
ad.drivePathModule:setWayPoints(path)
self.planning = false