fix(udkørsel): 'Wait at: All' vælger det ledige Wait-punkt nærmest flowets kilder, ikke nærmest traktoren (v1.57.1.0)

This commit is contained in:
2026-09-29 15:23:14 +02:00
parent 793f792f8b
commit a694d17a67
4 changed files with 29 additions and 3 deletions
+11 -1
View File
@@ -97,8 +97,18 @@ local function otherVehiclePositions(vehicle)
return positions
end
function ADWaitPool.pickFree(adEnv, vehicle, poolGroup, isReachable)
-- Midtpunkt af punkter {x, z} (fx flowets kilde-markører) -> x, z eller nil.
function ADWaitPool.anchorOf(points)
if points == nil or #points == 0 then return nil end
local sx, sz = 0, 0
for _, point in ipairs(points) do sx, sz = sx + point.x, sz + point.z end
return sx / #points, sz / #points
end
-- anchorX/anchorZ (valgfri): vælg nærmest dette punkt i stedet for traktoren (flow med "All": nærmest kilderne).
function ADWaitPool.pickFree(adEnv, vehicle, poolGroup, isReachable, anchorX, anchorZ)
local x, z = getVehiclePosition(vehicle)
if anchorX ~= nil and anchorZ ~= nil then x, z = anchorX, anchorZ end
if x == nil then
return nil
end