fix: slut-review — pcall om start/dialoger, Auto-varer fra aktivt AD-mål, nil-guards, README

This commit is contained in:
2026-09-22 23:35:47 +02:00
parent b74d1325c6
commit 856b949749
7 changed files with 99 additions and 27 deletions
+9 -6
View File
@@ -53,12 +53,15 @@ function ADLoadSwap.findDumpMarker(adEnv, vehicle, fillType, rest, homeWayPointI
local station = ADSmartPickup.getUnloadStationAtWayPointId(adEnv, marker.id, farmId)
if station ~= nil and isSilo(station, homeStation) and acceptsRest(station, fillType, rest, farmId) then
local wayPoint = adEnv.ADGraphManager:getWayPointById(marker.id)
local dx, dz = wayPoint.x - x, wayPoint.z - z
table.insert(candidates, {
marker = marker,
hasFillType = ADSmartPickup.getOwnStorageLevel(station, {fillType}) > 0,
distance = dx * dx + dz * dz,
})
-- En markør uden waypoint (stale AD-graf) skal springes over, ikke crashe hele opslaget.
if wayPoint ~= nil then
local dx, dz = wayPoint.x - x, wayPoint.z - z
table.insert(candidates, {
marker = marker,
hasFillType = ADSmartPickup.getOwnStorageLevel(station, {fillType}) > 0,
distance = dx * dx + dz * dz,
})
end
end
end
table.sort(candidates, function(a, b)