feat(diagnose): palleskur-afvisning i 'Lager til' siger præcis grund (siger nej til varen / fuldt / ingen vej / ingen markør) (v1.19.5.0)

This commit is contained in:
2026-09-24 20:53:45 +02:00
parent ff71fb4f43
commit 7dbdfe6645
4 changed files with 19 additions and 8 deletions
+16 -5
View File
@@ -187,19 +187,30 @@ local function findStoreMarker(adEnv, vehicle, product, capacity, sources, liter
if product.isPallet then if product.isPallet then
-- "Lager til" med palleskure: første valgte der tager varen, har plads og kan nås -- "Lager til" med palleskure: første valgte der tager varen, har plads og kan nås
local forcedSheds = run ~= nil and ADRunsController ~= nil and ADRunsController.getStoreBuildings ~= nil and ADRunsController.getStoreBuildings(adEnv, run) or {} local forcedSheds = run ~= nil and ADRunsController ~= nil and ADRunsController.getStoreBuildings ~= nil and ADRunsController.getStoreBuildings(adEnv, run) or {}
local hasForcedShed = false local hasForcedShed, reasons = false, {}
for _, building in ipairs(forcedSheds) do for _, building in ipairs(forcedSheds) do
if building.kind == "objectStorage" then if building.kind == "objectStorage" then
hasForcedShed = true hasForcedShed = true
local marker = building.unloadMarker or building.loadMarker local marker = building.unloadMarker or building.loadMarker
if marker ~= nil and ADSources.objectStorageAccepts(building.placeable, product.fillType) local free = ADSources.objectStorageFreeSlots(building.placeable)
and ADSources.objectStorageFreeSlots(building.placeable) >= 1 and isReachable(marker.id) then local why = nil
return {wayPointId = marker.id, name = tostring(building.name), free = ADSources.objectStorageFreeSlots(building.placeable)} if marker == nil then
why = "ingen markør"
elseif not ADSources.objectStorageAccepts(building.placeable, product.fillType) then
why = "palleskuret siger nej til varen"
elseif free < 1 then
why = "fuldt"
elseif not isReachable(marker.id) then
why = "ingen vej til '" .. tostring(marker.name) .. "'"
end end
if why == nil then
return {wayPointId = marker.id, name = tostring(building.name), free = free}
end
table.insert(reasons, string.format("%s: %s (%d ledige pladser)", tostring(building.name), why, free == math.huge and -1 or free))
end end
end end
if hasForcedShed then if hasForcedShed then
warnOnce(adEnv, vehicle, "forcedShed:" .. tostring(product.name), string.format("'%s': %s kan ikke sættes på lager — intet af de valgte palleskure tager varen, har plads og kan nås", tostring(ADRuns.vehicleLabel(vehicle)), tostring(product.name))) warnOnce(adEnv, vehicle, "forcedShed:" .. tostring(product.name) .. ":" .. table.concat(reasons, ";"), string.format("'%s': %s kan ikke sættes på lager — %s", tostring(ADRuns.vehicleLabel(vehicle)), tostring(product.name), table.concat(reasons, "; ")))
return nil return nil
end end
if ADSources.findPalletStore == nil then if ADSources.findPalletStore == nil then
+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.19.4.0</version> <version>1.19.5.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.19.4 · Farming Simulator 25 · tillæg til AutoDrive Version 1.19.5 · 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.19.4 · Farming Simulator 25 · add-on for AutoDrive Version 1.19.5 · Farming Simulator 25 · add-on for AutoDrive
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)* *Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*