fix(marker): slip kun sæt spilleren selv kører; slået mark uden sæt går videre til opsamling (v1.21.3.0)

In-game 25/9: spilleren satte sig i BiG M'en for at se CP-HUD'en -> sættet blev sluppet, og da CP var
færdig, blev det aldrig sendt hjem; marken ville have sendt slåmaskinen ud igen til en slået mark.
This commit is contained in:
2026-09-25 22:59:31 +02:00
parent 716045a36b
commit b1f1aaa148
5 changed files with 16 additions and 4 deletions
+8 -1
View File
@@ -33,6 +33,10 @@ function ADFieldJobs.decide(field, info, assignments, now)
if ACTIVE_PHASES[assignment.phase] then active = active + 1 end if ACTIVE_PHASES[assignment.phase] then active = active + 1 end
if assignment.phase == "finished" or assignment.phase == "returning" then finished = finished + 1 end if assignment.phase == "finished" or assignment.phase == "returning" then finished = finished + 1 end
end end
-- slået mark uden sæt på (sluppet undervejs, genindlæst): slåningen er gjort, videre til næste trin
if active == 0 and field.stage == "mowing" and info ~= nil and info.mowable and (info.readyRatio or 1) < ADFieldModel.CUT_RATIO then
return {action = "advance"}
end
if active == 0 and finished > 0 then if active == 0 and finished > 0 then
local stillStanding = field.stage == "mowing" and info ~= nil and (info.readyRatio or 0) >= ADFieldModel.CUT_RATIO local stillStanding = field.stage == "mowing" and info ~= nil and (info.readyRatio or 0) >= ADFieldModel.CUT_RATIO
if not stillStanding or finished >= ADFieldJobs.MAX_MOW_PASSES then return {action = "advance"} end if not stillStanding or finished >= ADFieldJobs.MAX_MOW_PASSES then return {action = "advance"} end
@@ -289,7 +293,10 @@ end
local function follow(adEnv, assignment) local function follow(adEnv, assignment)
local vehicle = assignment.vehicle local vehicle = assignment.vehicle
if isControlledByPlayer(vehicle) then -- Kun når spilleren selv KØRER (hverken Courseplay eller AutoDrive styrer): at sætte sig ind for at
-- kigge på HUD'en mens CP slår, må ikke slippe sættet (in-game 25/9: F22 blev aldrig sendt hjem).
local steeredByAi = ADCpBridge.isWorking(vehicle) or isAdActive(vehicle) or assignment.phase == "starting"
if isControlledByPlayer(vehicle) and not steeredByAi then
if assignment.handle ~= nil then assignment.handle.cancelled = true end if assignment.handle ~= nil then assignment.handle.cancelled = true end
log(assignment.fieldId, "'%s' frigivet — spilleren kører det", ADRuns.vehicleLabel(vehicle)) log(assignment.fieldId, "'%s' frigivet — spilleren kører det", ADRuns.vehicleLabel(vehicle))
return release(assignment) return release(assignment)
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107"> <modDesc descVersion="107">
<author>masterdraco</author> <author>masterdraco</author>
<version>1.21.2.0</version> <version>1.21.3.0</version>
<title> <title>
<en>AD Smart Pickup</en> <en>AD Smart Pickup</en>
</title> </title>
+1 -1
View File
@@ -1,6 +1,6 @@
# AD Smart Pickup — brugermanual # AD Smart Pickup — brugermanual
Version 1.21.2 · Farming Simulator 25 · tillæg til AutoDrive Version 1.21.3 · Farming Simulator 25 · tillæg til AutoDrive
*English version: [USER_MANUAL.md](USER_MANUAL.md)* *English version: [USER_MANUAL.md](USER_MANUAL.md)*
+1 -1
View File
@@ -1,6 +1,6 @@
# AD Smart Pickup — user manual # AD Smart Pickup — user manual
Version 1.21.2 · Farming Simulator 25 · add-on for AutoDrive Version 1.21.3 · Farming Simulator 25 · add-on for AutoDrive
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)* *Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*
+5
View File
@@ -38,5 +38,10 @@ local standing = {id = 109, markerId = 5, mowable = true, readyRatio = 0.8}
check("J6 én tur -> slå igen", J.decide(mowing, standing, {{phase = "finished"}}, 0).action, "dispatch") check("J6 én tur -> slå igen", J.decide(mowing, standing, {{phase = "finished"}}, 0).action, "dispatch")
check("J6 to ture -> videre", J.decide(mowing, standing, {{phase = "finished"}, {phase = "finished"}}, 0).action, "advance") check("J6 to ture -> videre", J.decide(mowing, standing, {{phase = "finished"}, {phase = "finished"}}, 0).action, "advance")
-- J7: slået mark uden sæt (fx sluppet undervejs) -> videre til opsamling, ikke en ny slå-tur
check("J7 slået uden sæt -> videre", J.decide(mowing, {id = 109, markerId = 5, mowable = true, readyRatio = 0.1}, {}, 0).action, "advance")
check("J7 stående uden sæt -> slå", J.decide(mowing, info, {}, 0).action, "dispatch")
check("J7 slået men sæt i gang -> vent", J.decide(mowing, {id = 109, markerId = 5, mowable = true, readyRatio = 0.1}, {{phase = "working"}}, 0).action, "none")
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL")) print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1) os.exit(failures == 0 and 0 or 1)