feat(lagre): vælg bygning -> statistik pr. vare: værdi nu/ved toppris, gårdens beholdning i døgn, forbrug og produktion pr. døgn (v1.15.0.0)

This commit is contained in:
2026-09-24 01:54:47 +02:00
parent eb053083c2
commit a6547462fc
10 changed files with 356 additions and 3 deletions
+22
View File
@@ -20,6 +20,7 @@ SellingStation = {}
dofile("FS25_ADSmartPickup/adSupplyPlanner.lua")
dofile("FS25_ADSmartPickup/adPrices.lua")
dofile("FS25_ADSmartPickup/adStorageStats.lua")
dofile("FS25_ADSmartPickup/adSources.lua")
local failures = 0
@@ -383,5 +384,26 @@ check("S17 gylle-enden: gylle", slurryEnd[1].fillType, SLURRY)
twoEndStation.loadTriggers[1].fillTypes = nil
check("S17 uden punkt-varer: stationens varer", #ADSources.getProducts(adEnv, ADSources.identify(adEnv, 40, 1), 1), 2)
-- S18: gårdens forbrug og produktion pr. døgn (fabrikker + stalde) og bedste markedspris
tmrFactory.spec_productionPoint.productionPoint.getIsProductionEnabled = function(self, id) return id == "tmr3" end
tmrFactory.spec_productionPoint.productionPoint.productions[1].outputs = {{type = FORAGE, amount = 240}}
cowBarn.spec_husbandryWater.automaticWaterSupply = false
local rates = ADSources.getFarmRates(adEnv, 1)
-- TMR-fabrik: 45 l roer × 200/60 cyklus/min × 1440 = 216.000 l/døgn; TMR ud 240 × 200/60 × 1440 = 1.152.000
check("S18 roer forbrug", math.floor(rates[BEET].consumption + 0.5), 216000)
check("S18 TMR produktion", math.floor(rates[FORAGE].production + 0.5), 1152000)
check("S18 halm i stald 500 l/t", rates[STRAW].consumption, 12000)
check("S18 vand 100 l/t", rates[WATER].consumption, 2400)
check("S18 anden farm tæller ikke", rates[STRAW].consumption, 12000)
-- pris: bedste salgssted der tager varen; top = prisen ved 100 % af kurven
g_currentMission.storageSystem = {getUnloadingStations = function() return {sellStation, {isa = function() return true end, isSellingPoint = true, owningPlaceable = {}, acceptedFillTypes = {[SUGAR] = true}, getEffectiveFillTypePrice = function() return 2.0 end}} end}
sellStation.getEffectiveFillTypePrice = function() return 1.5 end
g_currentMission.environment = {currentPeriod = 1}
DESC[SUGAR].economy = {factors = {0.8, 1.0}}
local quote = ADSources.getMarketQuote(SUGAR)
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)
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)