feat(lagre): staldenes produktion for alle dyretyper (mælk, gødning, gylle, æg, uld, gedemælk) fra output-kurver × antal dyr (v1.15.1.0)
This commit is contained in:
@@ -405,5 +405,43 @@ check("S18 bedste pris", quote.price, 2.0)
|
||||
check("S18 top ved 80 % af kurven", quote.top, 2.5)
|
||||
check("S18 intet salgssted -> nil", ADSources.getMarketQuote(FORAGE), nil)
|
||||
|
||||
-- S19: staldenes produktion pr. døgn fra dyrenes output-kurver (liter pr. dyr pr. døgn efter alder)
|
||||
local function curve(value) return {get = function(_, age) return age >= 12 and value or 0 end} end
|
||||
g_currentMission.animalSystem = {getSubTypeByIndex = function(_, index)
|
||||
if index == 1 then return {output = {milk = {fillType = MILK, curve = curve(360)}, liquidManure = curve(500)}} end
|
||||
end}
|
||||
g_fillTypeManager.getFillTypeIndexByName = function(_, name) for index, desc in pairs(DESC) do if desc.name == name then return index end end end
|
||||
local producingBarn = {
|
||||
rootNode = {x = 5000, z = 5000}, ownerFarmId = 1, getOwnerFarmId = function() return 1 end, getName = function() return "Malkestald" end,
|
||||
getHusbandryFillLevel = function() return 0 end,
|
||||
getClusters = function() return {
|
||||
{getSubTypeIndex = function() return 1 end, getAge = function() return 24 end, getNumAnimals = function() return 10 end},
|
||||
{getSubTypeIndex = function() return 1 end, getAge = function() return 6 end, getNumAnimals = function() return 5 end}, -- kalve: 0
|
||||
} end,
|
||||
}
|
||||
table.insert(g_currentMission.placeableSystem.placeables, producingBarn)
|
||||
local rates2 = ADSources.getFarmRates(adEnv, 1)
|
||||
check("S19 mælk 10 køer × 360", rates2[MILK].production, 3600)
|
||||
check("S19 gylle via navn", rates2[SLURRY].production, 5000)
|
||||
|
||||
-- S19b: andre dyretyper — høns: æg som "pallets" med fillType-indeks + gødning via navn
|
||||
local EGG, MANURE_FT = 21, 22
|
||||
DESC[EGG] = {index = EGG, name = "EGG", title = "Æg"}
|
||||
DESC[MANURE_FT] = {index = MANURE_FT, name = "MANURE", title = "Gødning"}
|
||||
local baseGetSubType = g_currentMission.animalSystem.getSubTypeByIndex
|
||||
g_currentMission.animalSystem.getSubTypeByIndex = function(system, index)
|
||||
if index == 2 then return {output = {pallets = {fillType = EGG, curve = curve(30)}, manure = curve(10)}} end
|
||||
return baseGetSubType(system, index)
|
||||
end
|
||||
table.insert(g_currentMission.placeableSystem.placeables, {
|
||||
rootNode = {x = 6000, z = 6000}, ownerFarmId = 1, getOwnerFarmId = function() return 1 end, getName = function() return "Hønsehus" end,
|
||||
getHusbandryFillLevel = function() return 0 end,
|
||||
getClusters = function() return {{subTypeIndex = 2, age = 12, numAnimals = 100}} end, -- felter i stedet for metoder
|
||||
})
|
||||
local rates3 = ADSources.getFarmRates(adEnv, 1)
|
||||
check("S19b æg 100 høns × 30", rates3[EGG] and rates3[EGG].production, 3000)
|
||||
check("S19b gødning via navn", rates3[MANURE_FT] and rates3[MANURE_FT].production, 1000)
|
||||
check("S19b mælk uændret", rates3[MILK].production, 3600)
|
||||
|
||||
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
|
||||
os.exit(failures == 0 and 0 or 1)
|
||||
|
||||
Reference in New Issue
Block a user