feat(flows): flow-vogne — flowets vogn huskes pr. traktor, solo-traktor henter sin vogn ved start (venter hvis den er lånt ud), stop/slet/bygning væk sætter vognen på plads og kører traktoren hjem; stoppede flows er ledige i maskinpuljen (v1.51.0.0)
This commit is contained in:
@@ -107,6 +107,7 @@ function ADPool.implementStatus(s)
|
||||
if s.parkName == nil then return "noPark" end
|
||||
if not s.hasConnect then return "noConnect", s.parkName end
|
||||
if s.attachedTo ~= nil then return "attached", s.attachedTo end
|
||||
if s.flowName ~= nil then return "flow", s.flowName end
|
||||
if (s.quarantineMin or 0) > 0 then return "quarantine", s.quarantineMin end
|
||||
if s.reserved then return "reserved" end
|
||||
return "parked", s.parkName
|
||||
@@ -308,6 +309,12 @@ function ADPool.cargoOf(vehicle)
|
||||
return carries, capacity
|
||||
end
|
||||
|
||||
-- Ikke bundet af et kørende flow (traktorer i stoppede flows er ledige).
|
||||
function ADPool.isFreeFromFlows(vehicle)
|
||||
if ADFlowWagons ~= nil then return ADFlowWagons.isFreeTractor(vehicle) end
|
||||
return ADRunsController.getRunForVehicle(vehicle) == nil
|
||||
end
|
||||
|
||||
local function isAttached(vehicle)
|
||||
return vehicle.getAttacherVehicle ~= nil and vehicle:getAttacherVehicle() ~= nil
|
||||
end
|
||||
@@ -335,7 +342,8 @@ function ADPool.collect(adEnv, isBusy)
|
||||
local connect = park ~= nil and ADPool.connectFor(park.name, markers) or nil
|
||||
local specs = connect ~= nil and ADCpBridge.getSpecs(vehicle) or nil
|
||||
local role = specs ~= nil and ADPool.roleOf(specs) or nil
|
||||
if role ~= nil then
|
||||
local held = role ~= nil and ADFlowWagons ~= nil and ADFlowWagons.isHeldWagon(ADRunsController.getVehicleId(vehicle))
|
||||
if role ~= nil and not held then
|
||||
local x, z = positionOf(vehicle)
|
||||
local carries, capacity = ADPool.cargoOf(vehicle)
|
||||
table.insert(implements, {carries = carries, capacity = capacity,
|
||||
@@ -352,7 +360,7 @@ function ADPool.collect(adEnv, isBusy)
|
||||
local park = parkMarker(adEnv, vehicle)
|
||||
local controlled = vehicle.getIsControlled ~= nil and vehicle:getIsControlled()
|
||||
if id ~= nil and park ~= nil and vehicle.spec_attacherJoints ~= nil and #ADHitch.rearImplementsOf(vehicle) == 0
|
||||
and ADRunsController.getRunForVehicle(vehicle) == nil and not controlled and not isBusy(vehicle)
|
||||
and ADPool.isFreeFromFlows(vehicle) and not controlled and not isBusy(vehicle)
|
||||
and not ADPool.isReturning(vehicle) and ADFieldFleet.isEnabled(state.fleetMode, state.fleet, id)
|
||||
and ADPool.canPull(ADPool.ownRole(vehicle)) then
|
||||
local x, z = positionOf(vehicle)
|
||||
@@ -387,6 +395,8 @@ function ADPool.overview(adEnv)
|
||||
attachedTo = attacher ~= nil and ADRuns.vehicleLabel(attacher) or nil,
|
||||
quarantineMin = id ~= nil and ADPool.quarantineMinutes(id, nowMs) or 0,
|
||||
reserved = id ~= nil and ADPool.isReserved(id),
|
||||
flowName = id ~= nil and ADFlowWagons ~= nil and ADFlowWagons.isHeldWagon(id)
|
||||
and tostring(ADFlowWagons.ownerOf(ADRunsController.store.runs, id).name) or nil,
|
||||
})
|
||||
table.insert(implements, {id = id, label = ADRuns.vehicleLabel(vehicle), role = role, status = key, arg = arg})
|
||||
end
|
||||
@@ -396,7 +406,7 @@ function ADPool.overview(adEnv)
|
||||
for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do
|
||||
local id = ADRunsController.getVehicleId(vehicle)
|
||||
-- en traktor med et redskab der giver den en markrolle, står allerede i flåden som kombination
|
||||
if id ~= nil and vehicle.spec_attacherJoints ~= nil and ADRunsController.getRunForVehicle(vehicle) == nil
|
||||
if id ~= nil and vehicle.spec_attacherJoints ~= nil and ADPool.isFreeFromFlows(vehicle)
|
||||
and ADPool.canPull(ADPool.ownRole(vehicle)) and ADFieldFleet.roleFromSpecs(ADCpBridge.getSpecs(vehicle)) == nil then
|
||||
local x, z = positionOf(vehicle)
|
||||
local distance = ADFieldWork.distanceToNetwork(adEnv, x, z)
|
||||
|
||||
Reference in New Issue
Block a user