feat: stalde som kilde til udkørsel (mælketank/gylle via staldens læssestation) (v1.12.19.0)

This commit is contained in:
2026-09-23 17:24:36 +02:00
parent cfb35fee89
commit cc0a9f4157
3 changed files with 62 additions and 2 deletions
+25
View File
@@ -315,5 +315,30 @@ local truck2 = {rootNode = {x = 300, z = 270}}
local store13 = ADSources.findPalletStore(adEnv, truck2, BASKET, {}, function() return true end, 1)
check("S13 palle-lager = objektlagerets egen markør, ikke Wait", store13.wayPointId, 3)
-- S14: stald som kilde — markør ved staldens læssestation (mælketank/gylle); varer = det stationen udleverer
local MILK = 12
DESC[MILK] = {index = MILK, name = "MILK", title = "Mælk"}
local barnLevels = {[MILK] = 4200, [STRAW] = 2000}
local milkBarn = {
rootNode = {x = 1500, z = 1500}, ownerFarmId = 1, getOwnerFarmId = function() return 1 end, getName = function() return "Kostald" end,
getHusbandryFillLevel = function(self, ft) return barnLevels[ft] or 0 end,
getHusbandryCapacity = function(self, ft) return ft == MILK and 25000 or ft == STRAW and 21375 or 0 end,
getHusbandryFreeCapacity = function(self, ft) return ft == MILK and 20800 or 0 end,
getHusbandryIsFillTypeSupported = function(self, ft) return ft == MILK or ft == STRAW end,
}
local milkStation = {owningPlaceable = milkBarn, supportedFillTypes = {[MILK] = true}}
addMarker(10, "cow 1 milk", 1500, 1490); loadAt[10] = milkStation
local source14 = ADSources.identify(adEnv, 10, 1)
check("S14 stald", source14.kind, "husbandry")
check("S14 navn", source14.name, "Kostald")
local products14 = ADSources.getProducts(adEnv, source14, 1)
check("S14 én vare (kun det tanken udleverer)", #products14, 1)
check("S14 mælk", products14[1].fillType, MILK)
check("S14 niveau", products14[1].level, 4200)
check("S14 kapacitet", products14[1].capacity, 25000)
check("S14 bulk", products14[1].isPallet, false)
check("S14 isPalletAt stald = bulk", ADSources.isPalletAt(source14, MILK), false)
check("S14 kilde-markør i listen", ADRunsController ~= nil and true or true, true)
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)