fix(silo): varer = læssestationens pulje (tom mælketank med fuld pulje viste ingen mælk -> noProducts); sammenlægning af kilder kun for siloer, ikke staldes mælke/gyllepunkter (v1.17.4.0)

This commit is contained in:
2026-09-24 04:01:26 +02:00
parent edf6805cac
commit c0f523700e
7 changed files with 51 additions and 4 deletions
+5 -1
View File
@@ -64,7 +64,11 @@ end
-- Lagrene en kildes læssestation trækker fra (FS25: sourceStorages = {[storage] = storage}); nil = ukendt.
local function sourceStorages(source)
local station = source ~= nil and source.station or nil
-- kun siloer: en stalds mælke- og gyllepunkt deler også lager, men er forskellige læssepunkter
if source == nil or source.kind ~= "silo" then
return nil
end
local station = source.station
if station == nil or type(station.sourceStorages) ~= "table" then
return nil
end
+15
View File
@@ -286,6 +286,21 @@ local function getSiloProducts(source)
end
end
end
-- Udvidelses-lagre (fx mælketanke med isExtension) deles af alle læssestationer inden for
-- storageRadius: tanken selv kan være tom mens puljen er fuld. Læssestationens tal er det man kan hente.
local station = source.station
if station ~= nil and station.getAllFillLevels ~= nil then
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
local ok, pooled, pooledCapacity = pcall(station.getAllFillLevels, station, farmId)
if ok and type(pooled) == "table" then
for fillType, level in pairs(pooled) do
if (level or 0) > (levels[fillType] or 0) then
levels[fillType] = level
capacities[fillType] = math.max(capacities[fillType] or 0, tonumber(pooledCapacity) or 0, level)
end
end
end
end
local products = {}
for fillType, level in pairs(levels) do
table.insert(products, newProduct(fillType, level, level, capacities[fillType] or 0, false))
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.17.3.0</version>
<version>1.17.4.0</version>
<title>
<en>AD Smart Pickup</en>
</title>