feat: diagnose i loggen når ingen autoload findes på traktorens enheder (v1.12.7.0)
This commit is contained in:
@@ -280,13 +280,33 @@ local function intersects(listA, listB)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Autoload = AutoDrives eget tjek (Universal Autoload med isAutoloadAvailable og ikke autoloadDisabled,
|
||||
-- eller aPalletAutoLoader). Findes ingen, logges én gang pr. traktor hvad enhederne har, så det kan
|
||||
-- ses i log.txt hvorfor (fx UAL uden konfiguration for køretøjet).
|
||||
local autoloadDiagnosed = setmetatable({}, {__mode = "k"})
|
||||
local function describeAutoloadUnit(unit)
|
||||
local name = unit.getName ~= nil and tostring(unit:getName()) or "?"
|
||||
local spec = unit.spec_universalAutoload
|
||||
if spec == nil then
|
||||
return string.format("%s (ingen spec_universalAutoload%s)", name, unit.spec_aPalletAutoLoader ~= nil and ", aPalletAutoLoader" or "")
|
||||
end
|
||||
return string.format("%s (isAutoloadAvailable=%s, autoloadDisabled=%s)", name, tostring(spec.isAutoloadAvailable), tostring(spec.autoloadDisabled))
|
||||
end
|
||||
|
||||
local function hasAutoload(adEnv, vehicle)
|
||||
local trailers = adEnv.AutoDrive.getAllUnits ~= nil and adEnv.AutoDrive.getAllUnits(vehicle) or nil
|
||||
for _, trailer in ipairs(trailers or {}) do
|
||||
if adEnv.AutoDrive.hasAL ~= nil and adEnv.AutoDrive:hasAL(trailer) then
|
||||
autoloadDiagnosed[vehicle] = nil
|
||||
return true
|
||||
end
|
||||
end
|
||||
if not autoloadDiagnosed[vehicle] then
|
||||
autoloadDiagnosed[vehicle] = true
|
||||
local parts = {}
|
||||
for _, unit in ipairs(trailers or {}) do table.insert(parts, describeAutoloadUnit(unit)) end
|
||||
Logging.info(ADRunsController.LOG_PREFIX .. "'%s': ingen autoload fundet på enhederne: %s", tostring(vehicle:getName()), #parts > 0 and table.concat(parts, "; ") or "(ingen enheder)")
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.12.6.0</version>
|
||||
<version>1.12.7.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user