chore: log-oprydning — fallback-markør én gang pr. stald, DEBUG én gang pr. mål/læs, 'collect' = afhentningsnavn — 1.62.297
This commit is contained in:
@@ -266,10 +266,10 @@ local function markerCandidates(adEnv, nodes)
|
||||
return found
|
||||
end
|
||||
|
||||
-- Markørnavnets rolle: "unload" (unload/drop/aflæs/aflever/indkast/tip) eller "load" (pickup/hent/læs/load) —
|
||||
-- Markørnavnets rolle: "unload" (unload/drop/aflæs/aflever/indkast/tip) eller "load" (pickup/hent/læs/load/collect) —
|
||||
-- aflæsning tjekkes først ("unload" og "aflæs" indeholder "load"/"læs"). nil = neutralt navn.
|
||||
local UNLOAD_WORDS = {"unload", "drop", "aflæs", "aflev", "indkast", "tip"}
|
||||
local LOAD_WORDS = {"pickup", "pick up", "hent", "læs", "load"}
|
||||
local LOAD_WORDS = {"pickup", "pick up", "hent", "læs", "load", "collect"} -- "collect": Milk/Manure/Slurry Collection (17/10)
|
||||
function ADBuildings.nameRole(name)
|
||||
local lower = tostring(name or ""):lower()
|
||||
for _, word in ipairs(UNLOAD_WORDS) do if lower:find(word, 1, true) then return "unload" end end
|
||||
@@ -413,7 +413,9 @@ function ADBuildings.ownedUnloadMarkers(chosen, nearby, owned, isLoad)
|
||||
local result, seen, rest = {}, {}, {}
|
||||
if chosen ~= nil then table.insert(result, chosen); seen[chosen.marker.id] = true end
|
||||
for _, entry in ipairs(nearby or {}) do
|
||||
if not seen[entry.marker.id] and owned ~= nil and owned[entry.marker.id] == true and not (isLoad or {})[entry.marker.id] then
|
||||
-- afhentningsnavne ('Manure Collection') er aldrig aflæsningsmål (17/10: dukkede op som mål i foderflowet)
|
||||
if not seen[entry.marker.id] and owned ~= nil and owned[entry.marker.id] == true and not (isLoad or {})[entry.marker.id]
|
||||
and ADBuildings.nameRole(entry.marker.name) ~= "load" then
|
||||
seen[entry.marker.id] = true
|
||||
table.insert(rest, entry)
|
||||
end
|
||||
@@ -593,6 +595,8 @@ function ADBuildings.ownedCandidates(candidates, owners, owner)
|
||||
return #kept > 0 and kept or candidates
|
||||
end
|
||||
|
||||
local fallbackLogged = {} -- "stald-id:markør-id" -> true
|
||||
|
||||
local function build(adEnv, farmId)
|
||||
local placeables = g_currentMission ~= nil and g_currentMission.placeableSystem ~= nil and g_currentMission.placeableSystem.placeables or {}
|
||||
local storage = g_currentMission ~= nil and g_currentMission.storageSystem or nil
|
||||
@@ -650,7 +654,8 @@ local function build(adEnv, farmId)
|
||||
-- ingen egen brugbar markør: hellere naboens end ingen (ellers hentes der aldrig)
|
||||
if marker == nil and candidates ~= allCandidates then
|
||||
marker = ADBuildings.pickLoadMarker(allCandidates, unloadBest, nodes.isSpawner == true, nodes.fillWords)
|
||||
if marker ~= nil then
|
||||
if marker ~= nil and fallbackLogged[id .. ":" .. tostring(marker.id)] == nil then
|
||||
fallbackLogged[id .. ":" .. tostring(marker.id)] = true -- én gang pr. stald og markør (listen bygges hvert 30. s)
|
||||
Logging.info("ADSmartPickup: stald '%s': ingen egen læssemarkør — bruger '%s' (%s m), som står nærmere en nabostald",
|
||||
tostring(getName(placeable, id)), tostring(marker.name), tostring(marker.distance))
|
||||
end
|
||||
|
||||
@@ -404,6 +404,7 @@ end
|
||||
ADUnloadWait.DEBUG_INTERVAL_MS = 15000
|
||||
local debugTimers = setmetatable({}, {__mode = "k"})
|
||||
local debugStuck = setmetatable({}, {__mode = "k"}) -- vehicle -> {level, since}: læsset uændret siden
|
||||
local debugLogged = setmetatable({}, {__mode = "k"}) -- vehicle -> {destination, rest}: sidst loggede DEBUG-linje
|
||||
ADUnloadWait.STUCK_WITH_ROOM_MS = 30000
|
||||
|
||||
local function debugAtTarget(adEnv, task, dt)
|
||||
@@ -463,6 +464,10 @@ local function debugAtTarget(adEnv, task, dt)
|
||||
local fillTypeName = g_fillTypeManager ~= nil and g_fillTypeManager:getFillTypeNameByIndex(fillType) or tostring(fillType)
|
||||
local distance = adEnv.AutoDrive.getDistanceToUnloadPosition ~= nil and adEnv.AutoDrive.getDistanceToUnloadPosition(vehicle) or -1
|
||||
local secondMarker = vehicle.ad.stateModule.getSecondMarker ~= nil and vehicle.ad.stateModule:getSecondMarker() or nil
|
||||
-- én gang pr. mål og læs (17/10: linjen kom hvert 15. s hele vejen til et fuldt mål)
|
||||
local logged = debugLogged[vehicle]
|
||||
if logged ~= nil and logged.destination == task.destinationID and math.abs(logged.rest - rest) < 1 then return end
|
||||
debugLogged[vehicle] = {destination = task.destinationID, rest = rest}
|
||||
Logging.info(ADUnloadWait.LOG_PREFIX .. "DEBUG '%s': targetReached=%s taskDest=%s adMål=%s; %.0f l %s på vognen; målet fri=%s/kap=%s; AD isUnloading=%s isLoading=%s afstandTilAflæsning=%.1f; venter=%s; %s", tostring(ADRuns.vehicleLabel(vehicle)), tostring(targetReached), tostring(task.destinationID), tostring(secondMarker ~= nil and secondMarker.id or nil), rest, tostring(fillTypeName), tostring(free), tostring(capacity), tostring(trailerModule ~= nil and trailerModule.isUnloading), tostring(trailerModule ~= nil and trailerModule.isLoading), tonumber(distance) or -1, tostring(waits[vehicle] ~= nil), table.concat(states, " | "))
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.62.296.0</version>
|
||||
<version>1.62.297.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user