fix(stald): foder-trigger søges i spec_husbandryFood (feedingTrough findes ikke i FS25) når stationen er uden noder — hønsehus; diagnose-log af feltnavne (v1.19.4.0)
This commit is contained in:
@@ -167,9 +167,10 @@ local function getLoadStationAtMarker(adEnv, wayPoint, farmId)
|
||||
return getClosestStation(adEnv, g_currentMission.storageSystem:getLoadingStations(), "loadTriggers", LOAD_TRIGGER_NODE_FIELDS, wayPoint, farmId)
|
||||
end
|
||||
|
||||
-- Staldes foderkrybbe (spec_husbandryFood.feedingTrough, samme tippe-trigger som AutoDrive bruger) står
|
||||
-- ikke altid i aflæsningsstationens unloadTriggers — hønsehuset har KUN krybben. Opslaget får derfor en
|
||||
-- proxy pr. krybbe der peger på staldens station (eller en minimal station). Caches i UNLOAD_CACHE_MS.
|
||||
-- En stalds foder-trigger står ikke altid i aflæsningsstationens unloadTriggers (hønsehuset har kun
|
||||
-- foder-triggeren under spec_husbandryFood; feltstien varierer). Står stationen uden trigger-noder, søges
|
||||
-- foderdataene, og opslaget får en proxy med de fundne noder, der peger på staldens station (eller en
|
||||
-- minimal station). Caches i UNLOAD_CACHE_MS.
|
||||
ADSmartPickup.UNLOAD_CACHE_MS = 1000
|
||||
local unloadCache = {list = nil, time = -math.huge}
|
||||
|
||||
@@ -191,16 +192,18 @@ local function getUnloadCandidates()
|
||||
end
|
||||
local placeables = g_currentMission.placeableSystem ~= nil and g_currentMission.placeableSystem.placeables or {}
|
||||
for _, placeable in pairs(placeables) do
|
||||
local food = placeable.spec_husbandryFood
|
||||
local trough = food ~= nil and food.feedingTrough or nil
|
||||
local node = trough ~= nil and (trough.exactFillRootNode or trough.triggerNode) or nil
|
||||
if node ~= nil then
|
||||
local station = byPlaceable[placeable] or {
|
||||
local ownStation = byPlaceable[placeable]
|
||||
local ownHasNodes = ownStation ~= nil and ownStation.unloadTriggers ~= nil and #ADSupplyPlanner.findTriggerNodes(ownStation.unloadTriggers, 1) > 0
|
||||
local foodNodes = (placeable.getHusbandryFillLevel ~= nil and not ownHasNodes) and ADSupplyPlanner.findTriggerNodes(placeable.spec_husbandryFood) or {}
|
||||
if #foodNodes > 0 then
|
||||
local triggers = {}
|
||||
for _, foodNode in ipairs(foodNodes) do table.insert(triggers, {exactFillRootNode = foodNode}) end
|
||||
local station = ownStation or {
|
||||
owningPlaceable = placeable,
|
||||
-- spillets adgangstjek kalder getOwnerFarmId på stationen
|
||||
getOwnerFarmId = function() return placeable.getOwnerFarmId ~= nil and placeable:getOwnerFarmId() or placeable.ownerFarmId end,
|
||||
}
|
||||
table.insert(list, setmetatable({unloadTriggers = {{exactFillRootNode = node}}}, {__index = station}))
|
||||
table.insert(list, setmetatable({unloadTriggers = triggers}, {__index = station}))
|
||||
end
|
||||
end
|
||||
unloadCache.list, unloadCache.time = list, now or -math.huge
|
||||
|
||||
Reference in New Issue
Block a user