fix(marker): arbejdsbredde = Courseplays egen workWidth-indstilling når den findes (v1.21.2.0)

In-game 25/9: variabel bredde gav 20,8 m for BiG M 450, Courseplay-HUD'en viser 40,8 m.
This commit is contained in:
2026-09-25 22:57:48 +02:00
parent bade84129b
commit 716045a36b
5 changed files with 22 additions and 3 deletions
+10
View File
@@ -44,7 +44,17 @@ local function variableWidth(object)
return nil
end
-- Courseplays egen bredde-indstilling (den i HUD'en) er den marken faktisk køres med.
local function courseplayWidth(vehicle)
if vehicle.getCourseGeneratorSettings == nil then return nil end
local ok, width = pcall(function() return vehicle:getCourseGeneratorSettings().workWidth:getValue() end)
if ok and type(width) == "number" and width > 0 then return width end
return nil
end
function ADCpBridge.getWorkWidth(vehicle)
local cpWidth = courseplayWidth(vehicle)
if cpWidth ~= nil then return cpWidth end
local best = 0
for _, object in ipairs(collect(vehicle)) do
local variable = variableWidth(object)
+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.1.0</version>
<version>1.21.2.0</version>
<title>
<en>AD Smart Pickup</en>
</title>
+1 -1
View File
@@ -1,6 +1,6 @@
# AD Smart Pickup — brugermanual
Version 1.21.1 · Farming Simulator 25 · tillæg til AutoDrive
Version 1.21.2 · Farming Simulator 25 · tillæg til AutoDrive
*English version: [USER_MANUAL.md](USER_MANUAL.md)*
+1 -1
View File
@@ -1,6 +1,6 @@
# AD Smart Pickup — user manual
Version 1.21.1 · Farming Simulator 25 · add-on for AutoDrive
Version 1.21.2 · Farming Simulator 25 · add-on for AutoDrive
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*
+9
View File
@@ -26,5 +26,14 @@ check("W2 AI-markører", ADCpBridge.getWorkWidth(plain), 9.5)
local mower = {getVariableWorkWidth = function(_, isLeft) return isLeft and 20.4 or -20.4, nil, true end}
check("W3 selvkørende", ADCpBridge.getWorkWidth(mower), 40.8)
-- W4: Courseplays egen bredde (HUD'en) vinder — det er den marken køres med
local cpVehicle = {getVariableWorkWidth = function(_, isLeft) return isLeft and 20.4 or -0.4, nil, true end,
getCourseGeneratorSettings = function() return {workWidth = {getValue = function() return 40.8 end}} end}
check("W4 Courseplay-bredde", ADCpBridge.getWorkWidth(cpVehicle), 40.8)
-- W5: Courseplay-indstilling 0/ugyldig -> egen beregning
local zeroCp = {getVariableWorkWidth = function(_, isLeft) return isLeft and 5 or -5, nil, true end,
getCourseGeneratorSettings = function() return {workWidth = {getValue = function() return 0 end}} end}
check("W5 CP 0 -> egen beregning", ADCpBridge.getWorkWidth(zeroCp), 10)
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)