feat(marksilo): marknummer foran silonavnet; statuslinje fortæller hvorfor ingen tømmevogn lånes (uden parkering/optaget/spiller i/ikke i flåden) (v1.38.7.0)

This commit is contained in:
2026-09-27 14:58:10 +02:00
parent 25867e2d88
commit 7e0a991ce6
5 changed files with 19 additions and 2 deletions
+12 -1
View File
@@ -138,7 +138,8 @@ function ADFieldSilos.collectBuildings(adEnv)
local x, z = position(building.placeable ~= nil and building.placeable.rootNode or nil)
if not seen[building.id] and not ADFieldSiloConfig.hasStore(ADFieldSilos.config, building.id) and not nearStore(stores, x, z) then
seen[building.id] = true
table.insert(silos, {id = building.id, name = building.name, markerId = firstMarker(building, "load"),
-- marknummeret først: navnet skæres af i fanen, og mange siloer hedder ens ("Farma 500 …")
table.insert(silos, {id = building.id, name = string.format("F%s %s", tostring(info.id), tostring(building.name)), markerId = firstMarker(building, "load"),
x = x, z = z, stock = siloStock(building.placeable)})
end
end
@@ -168,15 +169,25 @@ end
function ADFieldSilos.collectVehicles(adEnv)
local vehicles, byId = {}, {}
-- hvorfor tømmevogne ikke kan lånes (til fanens statuslinje)
local why = {notEnabled = 0, busy = 0, controlled = 0, noPark = 0}
for _, rig in ipairs(ADFieldWork.getRigs(adEnv)) do
-- uden AD-parkeringspunkt bliver vognen holdende på lagerets markør og spærrer for de næste
local canPark = ADFieldWork.parkMarkerId == nil or ADFieldWork.parkMarkerId(adEnv, rig.vehicle) ~= nil
if rig.role == "unloader" then
if not rig.enabled then why.notEnabled = why.notEnabled + 1
elseif rig.controlled then why.controlled = why.controlled + 1
elseif rig.busy then why.busy = why.busy + 1
elseif not canPark then why.noPark = why.noPark + 1 end
end
if rig.role == "unloader" and rig.enabled and not rig.busy and not rig.controlled and canPark then
local capacity, carries, cargo = trailerInfo(adEnv, rig.vehicle)
table.insert(vehicles, {id = rig.id, x = rig.x, z = rig.z, capacity = capacity, carries = carries, cargo = cargo})
byId[rig.id] = rig.vehicle
end
end
why.eligible = #vehicles
ADFieldSilos.lastVehicleReasons = why
return vehicles, byId
end