fix: fabrik fundet på afstand får produktionspunktets læssestation; bulk-outputs regnes ikke som paller når markøren ikke rammer triggeren (v1.12.5.0)

This commit is contained in:
2026-09-23 11:32:01 +02:00
parent e584fe22ea
commit e870c446d8
3 changed files with 22 additions and 3 deletions
+6 -2
View File
@@ -64,7 +64,9 @@ function ADSources.isPalletAt(source, fillType)
elseif source.kind == "objectStorage" then elseif source.kind == "objectStorage" then
return true return true
end 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 return false
end end
return ADSources.isPalletFillType(fillType) return ADSources.isPalletFillType(fillType)
@@ -135,7 +137,9 @@ function ADSources.identify(adEnv, wayPointId, farmId)
-- til pallespawneren; dernæst objektlagre. -- til pallespawneren; dernæst objektlagre.
local factory = findPlaceableNear(wayPoint, farmId, isProductionPoint) local factory = findPlaceableNear(wayPoint, farmId, isProductionPoint)
if factory ~= nil then 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 end
local storage = findPlaceableNear(wayPoint, farmId, isObjectStorage) local storage = findPlaceableNear(wayPoint, farmId, isObjectStorage)
if storage ~= nil then if storage ~= nil 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.12.4.0</version> <version>1.12.5.0</version>
<title> <title>
<en>AD Smart Pickup</en> <en>AD Smart Pickup</en>
</title> </title>
+15
View File
@@ -203,6 +203,21 @@ check("S9 station nil", source9.station, nil)
local products9 = ADSources.getProducts(adEnv, source9, 1) local products9 = ADSources.getProducts(adEnv, source9, 1)
check("S9 kurve er palle", products9[1].isPallet, true) 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) 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}) local excluded = ADSources.getSourcePlaceables({source1, source2})
check("S8 udelukkede placeables", excluded[factory] and excluded[silo], true) check("S8 udelukkede placeables", excluded[factory] and excluded[silo], true)