diff --git a/FS25_ADSmartPickup/adSources.lua b/FS25_ADSmartPickup/adSources.lua index a31b7f7..7564771 100644 --- a/FS25_ADSmartPickup/adSources.lua +++ b/FS25_ADSmartPickup/adSources.lua @@ -64,7 +64,9 @@ function ADSources.isPalletAt(source, fillType) elseif source.kind == "objectStorage" then return true end - if stationSupports(source.station, fillType) then + local productionPoint = getProductionPoint(source.placeable) + local loadingStation = productionPoint ~= nil and productionPoint.loadingStation or nil + if stationSupports(source.station, fillType) or stationSupports(loadingStation, fillType) then return false end return ADSources.isPalletFillType(fillType) @@ -135,7 +137,9 @@ function ADSources.identify(adEnv, wayPointId, farmId) -- til pallespawneren; dernæst objektlagre. local factory = findPlaceableNear(wayPoint, farmId, isProductionPoint) if factory ~= nil then - return {kind = "factory", placeable = factory, station = nil, wayPointId = wayPointId, name = getPlaceableName(factory, markerName)} + -- produktionspunktets egen læssestation (bulk-outputs), også når markøren ikke rammer triggeren + local loadingStation = getProductionPoint(factory).loadingStation + return {kind = "factory", placeable = factory, station = loadingStation, wayPointId = wayPointId, name = getPlaceableName(factory, markerName)} end local storage = findPlaceableNear(wayPoint, farmId, isObjectStorage) if storage ~= nil then diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml index 2c354e8..5dd4e57 100644 --- a/FS25_ADSmartPickup/modDesc.xml +++ b/FS25_ADSmartPickup/modDesc.xml @@ -1,7 +1,7 @@ masterdraco - 1.12.4.0 + 1.12.5.0 <en>AD Smart Pickup</en> diff --git a/tests/test_adSources.lua b/tests/test_adSources.lua index e307f0d..7411378 100644 --- a/tests/test_adSources.lua +++ b/tests/test_adSources.lua @@ -203,6 +203,21 @@ check("S9 station nil", source9.station, nil) local products9 = ADSources.getProducts(adEnv, source9, 1) check("S9 kurve er palle", products9[1].isPallet, true) check("S9 fabrik foretrækkes frem for objektlager i nærheden", ADSources.identify(adEnv, 7, 1).placeable, basketFactory) +-- S9b: fabrik fundet på afstand, men produktionspunktet HAR en læssestation (sukkerfabrik hvor markøren +-- ikke rammer triggeren): stationen hentes fra produktionspunktet, og sukker er bulk, ikke paller +local mill2Storage = storageOf({[SUGAR] = 1000}, {[SUGAR] = 180000}) +local mill2 = { + rootNode = {x = 1200, z = 1200}, getName = function() return "Sugar mill 2" end, + spec_productionPoint = {productionPoint = {productions = {{outputs = {{type = SUGAR, amount = 1}}}}, storage = mill2Storage, + loadingStation = {supportedFillTypes = {[SUGAR] = true}}}}, +} +table.insert(g_currentMission.placeableSystem.placeables, mill2) +addMarker(9, "Mill 2 load", 1210, 1190) +local source9b = ADSources.identify(adEnv, 9, 1) +check("S9b fabrik", source9b.kind, "factory") +check("S9b station fra produktionspunktet", source9b.station, mill2.spec_productionPoint.productionPoint.loadingStation) +check("S9b sukker = bulk", ADSources.isPalletAt(source9b, SUGAR), false) +check("S9b produkt bulk", ADSources.getProducts(adEnv, source9b, 1)[1].isPallet, false) local excluded = ADSources.getSourcePlaceables({source1, source2}) check("S8 udelukkede placeables", excluded[factory] and excluded[silo], true)