fix: AD's 'AL unload' sættes til center ved Start af udkørsel med autoload-bil (stod på fra → ingen aflæsning ved salgssted); pris-% = kurven alene (v1.12.10.0)

This commit is contained in:
2026-09-23 12:00:55 +02:00
parent 448af2bbea
commit a6e17d4f36
5 changed files with 52 additions and 15 deletions
+4 -5
View File
@@ -77,7 +77,9 @@ local function getCurrentPeriod()
end
-- {price, top, percent} for varen ved stationen; nil hvis stationen ikke kan prissætte den.
-- percent = kurve-% × (effektiv ÷ stationens grundpris nu); top = den pris der svarer til 100 %.
-- percent = kurve-% (faktor nu ÷ årets højeste). Stationens `fillTypePrices` bruges IKKE som
-- reference: in-game (23/9) gav effektiv 1602 mod grundpris 505 = 317 %, fordi grundprisen
-- hverken indeholder sværhedsgrad eller prisskala. top = prisen der svarer til 100 % af kurven.
function ADPrices.getQuote(station, fillType)
if station == nil or station.getEffectiveFillTypePrice == nil then
return nil
@@ -88,10 +90,7 @@ function ADPrices.getQuote(station, fillType)
end
local fillTypeDesc = g_fillTypeManager ~= nil and g_fillTypeManager.getFillTypeByIndex ~= nil and g_fillTypeManager:getFillTypeByIndex(fillType) or nil
local factors = fillTypeDesc ~= nil and fillTypeDesc.economy ~= nil and fillTypeDesc.economy.factors or nil
local curve = ADPrices.curvePercent(factors, getCurrentPeriod())
local baseNow = station.fillTypePrices ~= nil and tonumber(station.fillTypePrices[fillType]) or nil
local stationRatio = (baseNow ~= nil and baseNow > 0) and (effective / baseNow) or 1
local percent = math.floor(curve * stationRatio + 0.5)
local percent = ADPrices.curvePercent(factors, getCurrentPeriod())
local top = percent > 0 and (effective * 100 / percent) or effective
return {price = effective, top = top, percent = percent}
end