fix(bredde): forældet CP-bredde <1,5 m ignoreres -> AI-markører; diag: triggere ved mål der afvises (v1.62.244)

This commit is contained in:
2026-10-16 03:06:48 +02:00
parent 60010ee8ba
commit c55da307a1
5 changed files with 30 additions and 6 deletions
+14 -2
View File
@@ -969,11 +969,20 @@ end
-- Tager triggeren ved markøren varen? Alle bygningens triggere tæller — også fodertruget, der i CM-freestallen ligger
-- som en egen kandidat ved siden af stationen med halm/gylle/mælk (in-game 16/10: rest-TMR blev ikke sendt til den
-- tomme Kostald 2, fordi kun stationens triggere blev set). De nærmeste afgør (1.62.229: TMR ikke til halm-markøren).
function ADSmartPickup.markerTriggerAccepts(adEnv, wayPointId, fillType, farmId)
-- diag (valgfri tabel): bygning og hver trigger (afstand, tager varen, trug) til loggen (in-game 16/10: Kostald 2)
function ADSmartPickup.markerTriggerAccepts(adEnv, wayPointId, fillType, farmId, diag)
local wayPoint = wayPointId ~= nil and adEnv.ADGraphManager:getWayPointById(wayPointId) or nil
local station = wayPoint ~= nil and getUnloadStationAtMarker(adEnv, wayPoint, farmId) or nil
if station == nil then return false end
if station == nil then
if diag ~= nil then table.insert(diag, "ingen station ved markøren") end
return false
end
local owner = station.owningPlaceable
if diag ~= nil then
local ownerName = owner ~= nil and owner.getName ~= nil and owner:getName() or "?"
table.insert(diag, string.format("bygning '%s'%s", tostring(ownerName), station.unloadTriggers ~= nil and station.unloadTriggers[1] ~= nil
and station.unloadTriggers[1].isFoodProxy and " (første trigger = trug)" or ""))
end
local entries = {}
for _, candidate in ipairs(getUnloadCandidates()) do
if candidate == station or (owner ~= nil and candidate.owningPlaceable == owner) then
@@ -989,6 +998,9 @@ function ADSmartPickup.markerTriggerAccepts(adEnv, wayPointId, fillType, farmId)
accepts = triggerAcceptsFillType(trigger, fillType)
end
table.insert(entries, {distance = distance, accepts = accepts})
if diag ~= nil then
table.insert(diag, string.format("%.1f m %s%s", distance, accepts and "tager" or "nej", trigger.isFoodProxy and " (trug)" or ""))
end
end
end
end