diff --git a/FS25_ADSmartPickup/adStorageStats.lua b/FS25_ADSmartPickup/adStorageStats.lua index 1308981..09f15a3 100644 --- a/FS25_ADSmartPickup/adStorageStats.lua +++ b/FS25_ADSmartPickup/adStorageStats.lua @@ -1,6 +1,6 @@ -- AD Storage Stats -- Rene beregninger (ingen spil-API) til fanen Lagre: pr. vare i en bygning fyldning, værdi nu og --- ved årets toppris, gårdens samlede beholdning og hvor mange døgn den rækker ved gårdens forbrug. +-- ved årets toppris, gårdens samlede beholdning og hvor mange døgn den rækker ved gårdens nettoforbrug. ADStorageStats = {} @@ -22,7 +22,9 @@ function ADStorageStats.itemStats(item, farmTotal, rate, quote) consumption = consumption, production = production, net = production - consumption, - days = consumption > 0 and (farmTotal or level) / consumption or nil, + -- døgn til tom ved gårdens NETTO-forbrug; produktion ≥ forbrug = beholdningen stiger + days = consumption > production and (farmTotal or level) / (consumption - production) or nil, + rising = consumption > 0 and production >= consumption, } end diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.xml b/FS25_ADSmartPickup/gui/SmartPickupFrame.xml index 7b95632..2f9988c 100644 --- a/FS25_ADSmartPickup/gui/SmartPickupFrame.xml +++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.xml @@ -74,13 +74,13 @@ - - - - - - - + + + + + + + diff --git a/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua b/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua index 52304fa..b4aa134 100644 --- a/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua +++ b/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua @@ -98,7 +98,12 @@ function SmartPickupFrame:statCells(stat) if stat.valueNow ~= nil then now, top = SmartPickupFrame.formatMoney(stat.valueNow), SmartPickupFrame.formatMoney(stat.valueTop) end - local days = stat.days ~= nil and string.format(i18n:getText("spu_stat_days"), stat.days) or "-" + local days = "-" + if stat.days ~= nil then + days = string.format(i18n:getText("spu_stat_days"), stat.days) + elseif stat.rising then + days = i18n:getText("spu_stat_rising") + end return {self:fillTypeTitle(stat.fillType), here, now, top, fc(stat.farmTotal), days, ADStorageStats.rateText(stat.consumption, stat.production, fc)} end diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml index 17ec1a5..5c712f5 100644 --- a/FS25_ADSmartPickup/l10n/l10n_da.xml +++ b/FS25_ADSmartPickup/l10n/l10n_da.xml @@ -134,6 +134,7 @@ + @@ -149,6 +150,6 @@ - + diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml index 6999a11..024e363 100644 --- a/FS25_ADSmartPickup/l10n/l10n_en.xml +++ b/FS25_ADSmartPickup/l10n/l10n_en.xml @@ -134,6 +134,7 @@ + @@ -149,6 +150,6 @@ - + diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml index 4019c86..abd0484 100644 --- a/FS25_ADSmartPickup/modDesc.xml +++ b/FS25_ADSmartPickup/modDesc.xml @@ -1,7 +1,7 @@ masterdraco - 1.16.0.0 + 1.16.1.0 <en>AD Smart Pickup</en> diff --git a/docs/BRUGERMANUAL.md b/docs/BRUGERMANUAL.md index e8af2f1..32b997c 100644 --- a/docs/BRUGERMANUAL.md +++ b/docs/BRUGERMANUAL.md @@ -1,6 +1,6 @@ # AD Smart Pickup — brugermanual -Version 1.16.0 · Farming Simulator 25 · tillæg til AutoDrive +Version 1.16.1 · Farming Simulator 25 · tillæg til AutoDrive *English version: [USER_MANUAL.md](USER_MANUAL.md)* @@ -418,7 +418,7 @@ kolonneoverskrifter øverst: | **Værdi nu** | Værdien ved den bedste pris lige nu, blandt alle salgssteder på kortet | | **Ved toppris** | Værdien, hvis du sælger ved årets højeste pris | | **Gården** | Gårdens samlede beholdning af varen i alle bygninger, også dem på de andre faner | -| **Rækker til** | Hvor mange døgn gårdens beholdning holder ved det nuværende forbrug | +| **Rækker til** | Hvor mange døgn gårdens beholdning holder ved forbrug minus produktion. *stiger* betyder, at gården producerer mindst lige så meget, som den bruger | | **Forbrug/prod. døgn** | Forbrug pr. døgn med minus og produktion pr. døgn med plus | Nederst står **Bygningen i alt** med bygningens samlede værdi nu og ved toppris. diff --git a/docs/USER_MANUAL.md b/docs/USER_MANUAL.md index 427d450..c771c58 100644 --- a/docs/USER_MANUAL.md +++ b/docs/USER_MANUAL.md @@ -1,6 +1,6 @@ # AD Smart Pickup — user manual -Version 1.16.0 · Farming Simulator 25 · add-on for AutoDrive +Version 1.16.1 · Farming Simulator 25 · add-on for AutoDrive *Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)* @@ -422,7 +422,7 @@ one row per good: | **Value now** | The value at the best price right now, across all selling points on the map | | **At top price** | The value if you sell at the year's highest price | | **Farm** | The farm's total amount of the good across all buildings, including those on the other tabs | -| **Lasts** | How many days the farm's stock lasts at the current use | +| **Lasts** | How many days the farm's stock lasts at use minus production. *rising* means the farm produces at least as much as it uses | | **Use/prod. per day** | Daily use with a minus sign and daily production with a plus sign | At the bottom, **Building total** shows the building's total value now and at top price. diff --git a/tests/test_adStorageStats.lua b/tests/test_adStorageStats.lua index 8071b2d..25506cb 100644 --- a/tests/test_adStorageStats.lua +++ b/tests/test_adStorageStats.lua @@ -15,7 +15,7 @@ check("ST1 procent", st.percent, 83) check("ST1 værdi nu", st.valueNow, 240000) check("ST1 værdi top", st.valueTop, 300000) check("ST1 gårdens beholdning", st.farmTotal, 412000) -check("ST1 dage", math.floor(st.days * 10 + 0.5) / 10, 3.2) +check("ST1 dage på netto (412k / 82k)", math.floor(st.days * 10 + 0.5) / 10, 5.0) check("ST1 netto pr. døgn", st.net, -82000) -- ST2: ingen salgssted, intet forbrug, ingen kapacitet @@ -63,5 +63,12 @@ check("ST8 to siloer", #silos, 2) check("ST8 rækkefølge", silos[2].name, "C") check("ST8 ingen stalde", #S.filterKind(inv, "husbandry"), 0) +-- ST9: produktion ≥ forbrug -> beholdningen stiger, ingen dage +local rising = S.itemStats({fillType = 8, level = 1000, capacity = 2000}, 6700000, {consumption = 11500000, production = 19200000}, nil) +check("ST9 stiger -> dage nil", rising.days, nil) +check("ST9 stiger-flag", rising.rising, true) +check("ST1 falder -> ikke stiger", st.rising, false) +check("ST2 intet forbrug -> ikke stiger", st2.rising, false) + print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL")) os.exit(failures == 0 and 0 or 1)