feat(stald): æg/uld-paller fra staldens egne pallespawnere (hønsehus) som udkørselskilde; brændstoftanke er ikke lager-kilder (v1.18.8.0)
This commit is contained in:
@@ -104,6 +104,19 @@ local function collectNodes(placeable, loadStations, unloadStations)
|
||||
end
|
||||
if #nodes > 0 then table.insert(loadGroups, nodes) end
|
||||
end
|
||||
-- stald med egne pallespawnere (hønsehus: æg, fårestald: uld) — én læssegruppe pr. spawner
|
||||
local husbandryPallets = placeable.spec_husbandryPallets
|
||||
local seenSpawners = {}
|
||||
for _, palletSpawner in pairs(husbandryPallets ~= nil and husbandryPallets.fillTypeIndexToPalletSpawner or {}) do
|
||||
if not seenSpawners[palletSpawner] then
|
||||
seenSpawners[palletSpawner] = true
|
||||
local nodes = {}
|
||||
for _, place in ipairs(palletSpawner.spawnPlaces or {}) do
|
||||
if place.startNode ~= nil then table.insert(nodes, place.startNode) end
|
||||
end
|
||||
if #nodes > 0 then table.insert(loadGroups, nodes) end
|
||||
end
|
||||
end
|
||||
if placeable.spec_objectStorage ~= nil and placeable.rootNode ~= nil then
|
||||
table.insert(loadGroups, {placeable.rootNode})
|
||||
table.insert(unloadNodes, placeable.rootNode)
|
||||
@@ -249,9 +262,25 @@ local function isSellPlaceable(placeable, unloadStations)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Brændstof er ikke en vare der køres rundt (gårdens tankanlæg har en læssestation til diesel).
|
||||
local FUEL_FILL_TYPES = {DIESEL = true, DEF = true, ELECTRICCHARGE = true, METHANE = true}
|
||||
|
||||
local function isFuelOnly(station)
|
||||
local supported = station.supportedFillTypes
|
||||
if supported == nil or next(supported) == nil or g_fillTypeManager == nil then
|
||||
return false
|
||||
end
|
||||
for fillType, isSupported in pairs(supported) do
|
||||
if isSupported and not FUEL_FILL_TYPES[tostring(g_fillTypeManager:getFillTypeNameByIndex(fillType))] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function hasOwnLoadingStation(placeable, loadStations)
|
||||
for _, station in pairs(loadStations) do
|
||||
if station.owningPlaceable == placeable then return true end
|
||||
if station.owningPlaceable == placeable and not isFuelOnly(station) then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user