fix(flows): gamle mål der ikke længere er AD-markører (eller dublerer en valgt stald) ryddes fra forsynings-flows (v1.13.6.0)

This commit is contained in:
2026-09-24 00:47:04 +02:00
parent c60510ae0e
commit bb70170cf0
3 changed files with 14 additions and 1 deletions
+6
View File
@@ -328,6 +328,12 @@ function ADRunsController.resolveMarkers(adEnv, run)
if role == "load" and ADSources ~= nil and ADSources.identify ~= nil then if role == "load" and ADSources ~= nil and ADSources.identify ~= nil then
local source = ADSources.identify(adEnv, wayPointId, farmId) local source = ADSources.identify(adEnv, wayPointId, farmId)
keep = source ~= nil and not (source.placeable ~= nil and chosenPlaceables[source.placeable]) keep = source ~= nil and not (source.placeable ~= nil and chosenPlaceables[source.placeable])
elseif role == "unload" then
-- mål skal være en AD-MARKØR med aflæsningsstation (et slettet markør-id er kun et waypoint,
-- og AutoDrive kan ikke aflæsse dér); dubletter af valgte bygninger fjernes
local marker = adEnv.ADGraphManager.getMapMarkerByWayPointId ~= nil and adEnv.ADGraphManager:getMapMarkerByWayPointId(wayPointId) or nil
local station = marker ~= nil and ADSmartPickup.getUnloadStationAtWayPointId(adEnv, wayPointId, farmId) or nil
keep = station ~= nil and not (station.owningPlaceable ~= nil and chosenPlaceables[station.owningPlaceable])
end end
seen[wayPointId] = true seen[wayPointId] = true
if keep then if keep 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.13.5.0</version> <version>1.13.6.0</version>
<title> <title>
<en>AD Smart Pickup</en> <en>AD Smart Pickup</en>
</title> </title>
+7
View File
@@ -640,6 +640,13 @@ ADRunsController.updateRun(flowIn.id, {targetBuildingIds = {"barn1", "mill"}})
ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, flowIn.id)) ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, flowIn.id))
check("CF2 målmarkører", table.concat(ADRunsController.getRunTargets(ADRuns.getRun(ADRunsController.store, flowIn.id)), ","), "94,77") check("CF2 målmarkører", table.concat(ADRunsController.getRunTargets(ADRuns.getRun(ADRunsController.store, flowIn.id)), ","), "94,77")
check("CF2 primært mål", ADRuns.getRun(ADRunsController.store, flowIn.id).targetWayPointId, 94) check("CF2 primært mål", ADRuns.getRun(ADRunsController.store, flowIn.id).targetWayPointId, 94)
-- CF2b: gamle rå mål der ikke er en markør (slettet i AD) eller hører til en valgt bygning, ryddes
addMarker(78, "Anden stald food", "Cow Food", 3000, 0); unloadAt[78] = {accepts = {[TMR] = 1000}, owningPlaceable = "anden-stald"}
unloadAt[11062] = {accepts = {[TMR] = 1000}, owningPlaceable = "anden-stald"} -- waypoint uden markør
ADRunsController.updateRun(flowIn.id, {targetWayPointIds = {94, 77, 11062, 78}})
ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, flowIn.id))
check("CF2b ikke-markør fjernet, rå markør med station beholdt", table.concat(ADRunsController.getRunTargets(ADRuns.getRun(ADRunsController.store, flowIn.id)), ","), "94,77,78")
ADRunsController.updateRun(flowIn.id, {targetWayPointIds = {94, 77}})
-- CF3: migration: gamle markør-runs får bygninger -- CF3: migration: gamle markør-runs får bygninger
local oldOut = ADRunsController.createRun("Gammel ud", "outbound") local oldOut = ADRunsController.createRun("Gammel ud", "outbound")
ADRunsController.updateRun(oldOut.id, {sourceWayPointIds = {12694, 555}}) ADRunsController.updateRun(oldOut.id, {sourceWayPointIds = {12694, 555}})