fix(marker): arbejdsbredde læser variabel bredde (Unrealistic Pack) før AI-markører, som Courseplay (v1.21.1.0)

In-game 25/9: BiG M 450 læst som 10 m og læssevogn som 2,4 m, selv om begge står på 40,8 m.
This commit is contained in:
2026-09-25 22:45:01 +02:00
parent 61a32720ea
commit bade84129b
5 changed files with 49 additions and 4 deletions
+16 -1
View File
@@ -32,10 +32,25 @@ function ADCpBridge.getSpecs(vehicle)
return specs
end
-- Variabel bredde (Unrealistic Pack m.fl.) først, som Courseplays WorkWidthUtil: AI-markørerne står på
-- grundbredden (læssevogn 2,4 m selv om den er sat til 40,8 m).
local function variableWidth(object)
if object.getVariableWorkWidth == nil then return nil end
local okLeft, left, _, leftValid = pcall(object.getVariableWorkWidth, object, true)
local okRight, right, _, rightValid = pcall(object.getVariableWorkWidth, object)
if okLeft and okRight and leftValid and rightValid and type(left) == "number" and type(right) == "number" then
return math.abs(left) + math.abs(right)
end
return nil
end
function ADCpBridge.getWorkWidth(vehicle)
local best = 0
for _, object in ipairs(collect(vehicle)) do
if object.getAIMarkers ~= nil then
local variable = variableWidth(object)
if variable ~= nil then
best = math.max(best, variable)
elseif object.getAIMarkers ~= nil then
pcall(function() if object.updateAIMarkerWidth ~= nil then object:updateAIMarkerWidth() end end)
local ok, _, _, _, _, width = pcall(object.getAIMarkers, object)
if ok and type(width) == "number" and width > best then best = width 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.21.0.0</version>
<version>1.21.1.0</version>
<title>
<en>AD Smart Pickup</en>
</title>