fix: husket maskine sendes hjem når en anden med samme rolle allerede arbejder marken (F100 to kalkspredere) — 1.62.278
This commit is contained in:
@@ -320,7 +320,7 @@ end
|
||||
-- s = {fill, near, busy, controlled, tried}
|
||||
ADFieldJobs.emptyAttempts = {}
|
||||
-- Genoptag efter spilleren: en maskine moden frigav fordi spilleren kørte den. s = {controlled, busy, near,
|
||||
-- sameStage, hasRole, ageMs} -> "readopt" | "wait" | "forget" (in-game 4/10: Vario 2 kørt uden om en forhindring
|
||||
-- sameStage, hasRole, ageMs, otherWorking} -> "readopt" | "wait" | "forget" | "sendHome" (in-game 4/10: Vario 2 kørt uden om en forhindring
|
||||
-- og parkeret ved F14 — moden sendte i stedet en anden tømmevogn)
|
||||
ADFieldJobs.READOPT_MAX_MS = 1800000
|
||||
function ADFieldJobs.readoptAction(s)
|
||||
@@ -328,6 +328,9 @@ function ADFieldJobs.readoptAction(s)
|
||||
if s.busy and s.tripActive and s.sameStage and s.hasRole and (s.ageMs or 0) <= ADFieldJobs.READOPT_MAX_MS then return "wait" end
|
||||
if s.busy or not s.sameStage or not s.hasRole or (s.ageMs or 0) > ADFieldJobs.READOPT_MAX_MS then return "forget" end
|
||||
if s.controlled or not s.near then return "wait" end
|
||||
-- en anden maskine med samme rolle arbejder allerede marken (genoptaget ved indlæsning): to på samme kursus
|
||||
-- blokerer hinanden — den ankomne sendes hjem (in-game 16/10 F100: to kalkspredere holdt over for hinanden)
|
||||
if s.otherWorking then return "sendHome" end
|
||||
return "readopt"
|
||||
end
|
||||
|
||||
|
||||
@@ -2549,12 +2549,28 @@ function ADFieldWork.tickReadopt(adEnv)
|
||||
ADFieldWork.taken[vehicleId] = nil
|
||||
log(entry.fieldId, "'%s' nåede ikke frem (AutoDrive stoppet undervejs) — marken må få et andet sæt", tostring(rig.label))
|
||||
else
|
||||
local otherWorking = false
|
||||
for _, assignment in pairs(ADFieldJobs.state.assignments) do
|
||||
-- høstere undtaget (flere mejetærskere på én mark rører vi ikke ved)
|
||||
if assignment.fieldId == entry.fieldId and assignment.role == entry.role and entry.role ~= "harvester"
|
||||
and (assignment.helper == true) == (entry.helper == true)
|
||||
and assignment.vehicleId ~= rig.id and (assignment.phase == "working" or assignment.phase == "starting") then
|
||||
otherWorking = true
|
||||
end
|
||||
end
|
||||
local action = ADFieldJobs.readoptAction({controlled = rig.controlled, busy = rig.busy, near = near, tripActive = tripActive,
|
||||
sameStage = field.stage == entry.stage,
|
||||
hasRole = rig.role == entry.role or (rig.roles ~= nil and rig.roles[entry.role] == true),
|
||||
ageMs = now() - (entry.at or now())})
|
||||
ageMs = now() - (entry.at or now()), otherWorking = otherWorking})
|
||||
if action == "forget" then
|
||||
ADFieldWork.taken[vehicleId] = nil
|
||||
elseif action == "sendHome" then
|
||||
ADFieldWork.taken[vehicleId] = nil
|
||||
log(entry.fieldId, "'%s' sendes hjem — en anden %s arbejder allerede marken", tostring(rig.label), tostring(entry.role))
|
||||
if not (ADHitch ~= nil and ADHitch.returnHome(adEnv, rig.vehicle)) then
|
||||
local park = parkMarkerId(adEnv, rig.vehicle)
|
||||
if park ~= nil then startAd(adEnv, rig.vehicle, adEnv.AutoDrive.MODE_DRIVETO, park, nil) end
|
||||
end
|
||||
elseif action == "readopt" then
|
||||
ADFieldWork.taken[vehicleId] = nil
|
||||
-- erstatningen der stadig er på vej, sendes hjem
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.277.0</version>
|
||||
<version>1.62.278.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user