diff --git a/FS25_ADSmartPickup/adRunsController.lua b/FS25_ADSmartPickup/adRunsController.lua
index 3e923c1..aa906ec 100644
--- a/FS25_ADSmartPickup/adRunsController.lua
+++ b/FS25_ADSmartPickup/adRunsController.lua
@@ -1120,6 +1120,46 @@ function ADRunsController.getRunStatus(adEnv, run)
return {running = running, total = #run.vehicleIds, isRunning = isRunning}
end
+-- Start alle (Oversigt): flows der allerede kører røres ikke, så et halvt kørende gårdbillede kan
+-- "fyldes op" uden at traktorer midt i en tur afbrydes. Flows uden traktorer springes over.
+function ADRunsController.startAllRuns(adEnv)
+ local summary = {runsStarted = 0, alreadyRunning = 0, vehiclesStarted = 0, results = {}}
+ for _, run in ipairs(ADRunsController.store.runs) do
+ if #run.vehicleIds > 0 then
+ if ADRunsController.getRunStatus(adEnv, run).isRunning then
+ summary.alreadyRunning = summary.alreadyRunning + 1
+ else
+ local startedHere = 0
+ for _, result in ipairs(ADRunsController.startRun(adEnv, run.id)) do
+ table.insert(summary.results, result)
+ if result.ok then startedHere = startedHere + 1 end
+ end
+ summary.vehiclesStarted = summary.vehiclesStarted + startedHere
+ if startedHere > 0 then summary.runsStarted = summary.runsStarted + 1 end
+ end
+ end
+ end
+ return summary
+end
+
+-- Stop alle: stopper alle aktive traktorer i alle flows (også dem der er startet manuelt i AD).
+function ADRunsController.stopAllRuns(adEnv)
+ local stopped = 0
+ for _, run in ipairs(ADRunsController.store.runs) do
+ stopped = stopped + ADRunsController.stopRun(adEnv, run.id)
+ end
+ return stopped
+end
+
+function ADRunsController.hasActiveRuns(adEnv)
+ for _, run in ipairs(ADRunsController.store.runs) do
+ if ADRunsController.getRunStatus(adEnv, run).running > 0 then
+ return true
+ end
+ end
+ return false
+end
+
-- ---- overblik ----
-- Hvad laver traktoren lige nu? {kind = "stopped"|"waiting"|"loaded"|"empty", fillType, liters, place}
diff --git a/FS25_ADSmartPickup/adSources.lua b/FS25_ADSmartPickup/adSources.lua
index 64d5734..0e5a4b6 100644
--- a/FS25_ADSmartPickup/adSources.lua
+++ b/FS25_ADSmartPickup/adSources.lua
@@ -894,6 +894,7 @@ local function addEntry(entries, fillType, level, capacity, extra)
local entry = newProduct(fillType, level, level, capacity, false)
entry.isOutput = extra ~= nil and extra.isOutput or false
entry.count = extra ~= nil and extra.count or nil
+ entry.slots = extra ~= nil and extra.slots or nil
table.insert(entries, entry)
end
@@ -936,7 +937,10 @@ local function objectStorageEntries(placeable)
local fillType, perObject = getObjectInfoContent(objectInfo)
local count = objectInfo.numObjects or 0
if fillType ~= nil and count > 0 then
- addEntry(entries, fillType, count * perObject, spec.capacity or 0, {count = count})
+ -- spec.capacity er PLADSER (delt mellem alle varer); i liter: (egne + ledige) paller x indhold
+ local free = ADSources.objectStorageFreeSlots(placeable)
+ local slots = free ~= math.huge and count + free or nil -- skur uden grænse: ingen procent
+ addEntry(entries, fillType, count * perObject, slots ~= nil and slots * perObject or 0, {count = count, slots = slots})
end
end
return entries
diff --git a/FS25_ADSmartPickup/adStorageStats.lua b/FS25_ADSmartPickup/adStorageStats.lua
index 09f15a3..efe0510 100644
--- a/FS25_ADSmartPickup/adStorageStats.lua
+++ b/FS25_ADSmartPickup/adStorageStats.lua
@@ -11,11 +11,18 @@ function ADStorageStats.itemStats(item, farmTotal, rate, quote)
local capacity = item.capacity or 0
local consumption = rate ~= nil and rate.consumption or 0
local production = rate ~= nil and rate.production or 0
+ -- palleskure: fyldning i paller af pladser (kapaciteten er et antal pladser, ikke liter)
+ local percent = capacity > 0 and math.floor(100 * level / capacity + 0.5) or nil
+ if item.count ~= nil and (item.slots or 0) > 0 then
+ percent = math.floor(100 * item.count / item.slots + 0.5)
+ end
return {
fillType = item.fillType,
level = level,
capacity = capacity,
- percent = capacity > 0 and math.floor(100 * level / capacity + 0.5) or nil,
+ count = item.count,
+ slots = item.slots,
+ percent = percent,
valueNow = quote ~= nil and quote.price ~= nil and math.floor(level * quote.price + 0.5) or nil,
valueTop = quote ~= nil and quote.top ~= nil and math.floor(level * quote.top + 0.5) or nil,
farmTotal = farmTotal or level,
diff --git a/FS25_ADSmartPickup/gui/SmartPickupFlowTab.lua b/FS25_ADSmartPickup/gui/SmartPickupFlowTab.lua
index b8f07d6..dd493b2 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupFlowTab.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupFlowTab.lua
@@ -64,15 +64,45 @@ function SmartPickupFrame:flowCells(adEnv, run)
return {name, products, from, to, string.format("%d/%d", row.running, row.total), status}
end
--- Fanen Oversigt: alle flows som tabel, grupperet Ind/Ud efter navn.
+-- Hele rækken klikbar med musen (Bitmap-rækker har ingen onClick). Klikket gemmes kun som
+-- pendingJumpRunId; hoppet sker i update(), fordi genopbygningen sletter netop denne række.
+local MOUSE_LEFT = Input ~= nil and Input.MOUSE_BUTTON_LEFT or 1
+
+local function isInside(element, posX, posY)
+ local position, size = element.absPosition, element.absSize
+ if position == nil or size == nil then return false end
+ return posX >= position[1] and posX <= position[1] + size[1] and posY >= position[2] and posY <= position[2] + size[2]
+end
+
+function SmartPickupFrame:makeRowClickable(row, runId)
+ local frame = self
+ local baseMouseEvent = row.mouseEvent
+ row.mouseEvent = function(element, posX, posY, isDown, isUp, button, eventUsed)
+ local used = baseMouseEvent(element, posX, posY, isDown, isUp, button, eventUsed)
+ -- også inden for listens synlige udsnit: rækker scrollet ud af syne må ikke fange klik
+ if not used and not eventUsed and isUp and button == MOUSE_LEFT and (element.getIsVisible == nil or element:getIsVisible())
+ and isInside(element, posX, posY) and isInside(frame.boxLayout, posX, posY) then
+ frame.pendingJumpRunId = runId
+ return true
+ end
+ return used
+ end
+end
+
+-- Fanen Oversigt: alle flows som tabel, grupperet Ind/Ud efter navn. Klik på et flow = redigér det.
function SmartPickupFrame:fillOverviewRows(adEnv)
self.overviewRows = {}
local i18n = self.i18n
+ self:addTextRow(i18n:getText("spu_overview_hint"))
self:addCellRow(self.flowPrefab, {i18n:getText("spu_col_flow"), i18n:getText("spu_col_goods"), i18n:getText("spu_col_from"), i18n:getText("spu_col_to"), i18n:getText("spu_col_tractors"), i18n:getText("spu_col_status")})
for _, group in ipairs(ADFlowView.boardGroups(ADRunsController.store.runs)) do
self:addTextRow(i18n:getText(group.kind == "outbound" and "spu_board_outbound" or "spu_board_supply"))
for _, run in ipairs(group.runs) do
- table.insert(self.overviewRows, {runId = run.id, cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))})
+ local cells = self:addCellRow(self.flowPrefab, self:flowCells(adEnv, run))
+ if cells[1] ~= nil and cells[1].parent ~= nil then
+ self:makeRowClickable(cells[1].parent, run.id)
+ end
+ table.insert(self.overviewRows, {runId = run.id, cells = cells})
end
end
if #ADRunsController.store.runs == 0 then
diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
index 4c44778..d829a0b 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
@@ -8,6 +8,7 @@ SmartPickupFrame._mt = Class(SmartPickupFrame, TabbedMenuFrameElement)
SmartPickupFrame.REFRESH_INTERVAL_MS = 1000
SmartPickupFrame.STATUS_OVERRIDE_TICKS = 6
+SmartPickupFrame.MAX_STATUS_REASONS = 3
SmartPickupFrame.LOG_PREFIX = "ADSmartPickup: "
SmartPickupFrame.STATE_OFF, SmartPickupFrame.STATE_ON = 1, 2
SmartPickupFrame.TAB_OVERVIEW, SmartPickupFrame.TAB_FLOWS = 1, 2
@@ -45,8 +46,13 @@ function SmartPickupFrame.new(i18n, getAdEnv)
self.newButtonInfo = {inputAction = InputAction.MENU_EXTRA_1, text = i18n:getText("spu_button_new"), callback = function() self:onClickNew() end}
self.renameButtonInfo = {inputAction = InputAction.MENU_EXTRA_2, text = i18n:getText("spu_button_rename"), callback = function() self:onClickRename() end}
self.deleteButtonInfo = {inputAction = InputAction.MENU_CANCEL, text = i18n:getText("spu_button_delete"), callback = function() self:onClickDelete() end}
+ -- Oversigt: Start/Stop alle i stedet for knapperne der virker på ét valgt flow.
+ self.startAllButtonInfo = {inputAction = InputAction.MENU_ACTIVATE, text = i18n:getText("spu_button_startAll"), callback = function() self:onClickStartAll() end}
+ self.stopAllButtonInfo = {inputAction = InputAction.MENU_EXTRA_2, text = i18n:getText("spu_button_stopAll"), callback = function() self:onClickStopAll() end}
+ self.flowButtons = {self.backButtonInfo, self.startButtonInfo, self.newButtonInfo, self.renameButtonInfo, self.deleteButtonInfo}
+ self.overviewButtons = {self.backButtonInfo, self.startAllButtonInfo, self.stopAllButtonInfo, self.newButtonInfo}
-- Egen reference til listen: fallback'en i refreshButtons skal kunne sende den igen.
- self.menuButtonInfo = {self.backButtonInfo, self.startButtonInfo, self.newButtonInfo, self.renameButtonInfo, self.deleteButtonInfo}
+ self.menuButtonInfo = self.overviewButtons
self:setMenuButtonInfo(self.menuButtonInfo)
return self
end
@@ -195,7 +201,11 @@ end
-- dets egen klik-håndtering, hopper værdien frem og tilbage og fokus ryger.
function SmartPickupFrame:update(dt)
SmartPickupFrame:superClass().update(self, dt)
- if self.pendingRebuild then
+ if self.pendingJumpRunId ~= nil then
+ local runId = self.pendingJumpRunId
+ self.pendingJumpRunId = nil
+ self:safe(function(frame) frame:openFlow(runId) end)
+ elseif self.pendingRebuild then
self.pendingRebuild = false
self:safe(self.rebuild)
end
@@ -632,6 +642,11 @@ end
-- setMenuButtonInfoDirty findes i FS22/25's TabbedMenuFrameElement; mangler den,
-- sendes listen igen. Kaldes hvert sekund, så den må aldrig kaste.
function SmartPickupFrame:refreshButtons()
+ local wanted = self.currentTab == SmartPickupFrame.TAB_OVERVIEW and self.overviewButtons or self.flowButtons
+ if self.menuButtonInfo ~= wanted then
+ self.menuButtonInfo = wanted
+ self:setMenuButtonInfo(wanted)
+ end
if self.setMenuButtonInfoDirty ~= nil then
self:setMenuButtonInfoDirty()
else
@@ -647,12 +662,22 @@ function SmartPickupFrame:refreshLive()
self:setStatusText(self.i18n:getText("spu_status_noAd"))
return
end
- if self.currentTab == SmartPickupFrame.TAB_OVERVIEW then
+ local isOverview = self.currentTab == SmartPickupFrame.TAB_OVERVIEW
+ if isOverview then
self:refreshOverview(adEnv)
end
self:refreshStorageRows(adEnv)
local isRunning = false
- if run ~= nil then
+ if isOverview then
+ local running, total, activeRuns = 0, 0, 0
+ for _, anyRun in ipairs(ADRunsController.store.runs) do
+ local status = ADRunsController.getRunStatus(adEnv, anyRun)
+ running, total = running + status.running, total + status.total
+ if status.running > 0 then activeRuns = activeRuns + 1 end
+ end
+ self:setStatusText(self.statusOverride or string.format(self.i18n:getText("spu_status_overview"), running, total, activeRuns, #ADRunsController.store.runs))
+ self.stopAllButtonInfo.disabled = running == 0
+ elseif run ~= nil then
self:syncOptionsFromModel(adEnv, run)
if run.kind == "outbound" then
self:refreshOutboundRows(adEnv, run)
@@ -766,30 +791,80 @@ function SmartPickupFrame:onClickStartStop()
ADRunsController.stopRun(adEnv, run.id)
frame.statusOverride = nil
else
- local started, skipped, reasons = 0, 0, {}
- for _, result in ipairs(ADRunsController.startRun(adEnv, run.id)) do
- if result.ok then
- started = started + 1
- else
- skipped = skipped + 1
- local reasonText = frame.i18n:getText("spu_reason_" .. tostring(result.reason))
- if result.reason == "noMarker" and result.missingBuilding ~= nil then
- reasonText = string.format(reasonText, tostring(result.missingBuilding))
- end
- table.insert(reasons, string.format("%s: %s", tostring(ADRuns.vehicleLabel(result.vehicle)), reasonText))
- end
- end
- frame.statusOverride = string.format(frame.i18n:getText("spu_status_started"), started, skipped)
- if #reasons > 0 then
- frame.statusOverride = frame.statusOverride .. " — " .. table.concat(reasons, "; ")
- end
- frame.statusOverrideTicks = SmartPickupFrame.STATUS_OVERRIDE_TICKS
+ local started, skipped, reasons = frame:summarizeStartResults(ADRunsController.startRun(adEnv, run.id))
+ frame:showOverride(string.format(frame.i18n:getText("spu_status_started"), started, skipped), reasons)
end
ADRunsController.save()
frame:requestRebuild()
end)
end
+-- Start-resultater -> antal startet/sprunget over + "Traktor: grund"-liste til statuslinjen.
+function SmartPickupFrame:summarizeStartResults(results)
+ local started, skipped, reasons = 0, 0, {}
+ for _, result in ipairs(results) do
+ if result.ok then
+ started = started + 1
+ else
+ skipped = skipped + 1
+ local reasonText = self.i18n:getText("spu_reason_" .. tostring(result.reason))
+ if result.reason == "noMarker" and result.missingBuilding ~= nil then
+ reasonText = string.format(reasonText, tostring(result.missingBuilding))
+ end
+ table.insert(reasons, string.format("%s: %s", tostring(ADRuns.vehicleLabel(result.vehicle)), reasonText))
+ end
+ end
+ return started, skipped, reasons
+end
+
+function SmartPickupFrame:showOverride(text, reasons)
+ if reasons ~= nil and #reasons > 0 then
+ -- én statuslinje: højst MAX_STATUS_REASONS grunde, resten står i log.txt
+ local shown = {}
+ for index = 1, math.min(#reasons, SmartPickupFrame.MAX_STATUS_REASONS) do shown[index] = reasons[index] end
+ text = text .. " — " .. table.concat(shown, "; ")
+ if #reasons > #shown then text = text .. string.format(" (+%d)", #reasons - #shown) end
+ end
+ self.statusOverride = text
+ self.statusOverrideTicks = SmartPickupFrame.STATUS_OVERRIDE_TICKS
+ self:setStatusText(text)
+end
+
+function SmartPickupFrame:onClickStartAll()
+ self:safe(function(frame)
+ local adEnv = frame.getAdEnv()
+ if adEnv == nil then return end
+ local summary = ADRunsController.startAllRuns(adEnv)
+ local _, skipped, reasons = frame:summarizeStartResults(summary.results)
+ Logging.info(SmartPickupFrame.LOG_PREFIX .. "Start alle: %d flows startet (%d traktorer), %d kørte allerede, %d sprunget over",
+ summary.runsStarted, summary.vehiclesStarted, summary.alreadyRunning, skipped)
+ frame:showOverride(string.format(frame.i18n:getText("spu_status_startedAll"), summary.runsStarted, summary.vehiclesStarted, summary.alreadyRunning, skipped), reasons)
+ ADRunsController.save()
+ frame:requestRebuild()
+ end)
+end
+
+function SmartPickupFrame:onClickStopAll()
+ self:safe(function(frame)
+ local adEnv = frame.getAdEnv()
+ if adEnv == nil then return end
+ local stopped = ADRunsController.stopAllRuns(adEnv)
+ Logging.info(SmartPickupFrame.LOG_PREFIX .. "Stop alle: %d traktorer stoppet", stopped)
+ frame:showOverride(string.format(frame.i18n:getText("spu_status_stoppedAll"), stopped))
+ ADRunsController.save()
+ frame:requestRebuild()
+ end)
+end
+
+-- Klik på en række i Oversigt: vælg flowet og hop til fanen Flows (kaldes fra update, aldrig inde i
+-- rækkens eget mouseEvent — rækken slettes af genopbygningen).
+function SmartPickupFrame:openFlow(runId)
+ if ADRuns.getRun(ADRunsController.store, runId) == nil then return end
+ self.selectedRunId = runId
+ self.statusOverride = nil
+ self:switchTab(SmartPickupFrame.TAB_FLOWS)
+end
+
-- Nyt run: navnet vælges FØR run'et oprettes (annulleres dialogen, oprettes intet).
-- Forslaget tæller efter antal runs, ikke efter løbenummeret, så "Run 2" kan genbruges.
function SmartPickupFrame:onClickNew()
diff --git a/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua b/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua
index b4aa134..c346687 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupStorageTab.lua
@@ -93,6 +93,9 @@ function SmartPickupFrame:statCells(stat)
local i18n = self.i18n
local fc = SmartPickupFrame.formatCompact
local here = string.format("%s/%s", fc(stat.level), fc(stat.capacity))
+ if stat.count ~= nil and stat.slots ~= nil then
+ here = string.format(i18n:getText("spu_stat_pallets"), stat.count, stat.slots)
+ end
if stat.percent ~= nil then here = here .. string.format(" %d %%", stat.percent) end
local now, top = i18n:getText("spu_stat_noSell"), ""
if stat.valueNow ~= nil then
diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml
index d753aac..f341903 100644
--- a/FS25_ADSmartPickup/l10n/l10n_da.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_da.xml
@@ -33,6 +33,12 @@
+
+
+
+
+
+
@@ -63,6 +69,7 @@
+
diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml
index 1cbba5a..6ae257e 100644
--- a/FS25_ADSmartPickup/l10n/l10n_en.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_en.xml
@@ -33,6 +33,12 @@
+
+
+
+
+
+
@@ -63,6 +69,7 @@
+
diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml
index cef52c3..8206710 100644
--- a/FS25_ADSmartPickup/modDesc.xml
+++ b/FS25_ADSmartPickup/modDesc.xml
@@ -1,7 +1,7 @@
masterdraco
- 1.19.10.0
+ 1.20.0.0
AD Smart Pickup
diff --git a/docs/BRUGERMANUAL.md b/docs/BRUGERMANUAL.md
index f0ba78c..a796423 100644
--- a/docs/BRUGERMANUAL.md
+++ b/docs/BRUGERMANUAL.md
@@ -1,6 +1,6 @@
# AD Smart Pickup — brugermanual
-Version 1.19.10 · Farming Simulator 25 · tillæg til AutoDrive
+Version 1.20.0 · Farming Simulator 25 · tillæg til AutoDrive
*English version: [USER_MANUAL.md](USER_MANUAL.md)*
@@ -137,6 +137,9 @@ Fanen **Overblik** viser alle flows som en tabel med kolonnerne **Flow**, **Vare
**Kører** og **Status**. Det valgte flow er markeret med `>`. Kører viser traktorer i gang ud af flowets
traktorer. Status viser en advarsel, grunden til at traktorerne holder, eller flowets regel.
+**Klik på et flow** i tabellen for at hoppe direkte til fanen **Flows** med det flow valgt. Statuslinjen
+nederst viser, hvor mange traktorer og flows der kører i alt.
+
Tidligere stod tavlen som én lang linje pr. flow:
```
@@ -161,6 +164,17 @@ samme rækkefølge.
| **Slet run** | Sletter flowet og stopper dets kørende traktorer. Kan ikke fortrydes |
| **Start run / Stop run** | Starter eller stopper alle traktorer i flowet |
+På fanen **Overblik** er knapperne i stedet:
+
+| Knap | Funktion |
+|---|---|
+| **Start alle flows** | Starter alle flows med traktorer. Flows, der allerede kører, røres ikke, så ingen tur afbrydes |
+| **Stop alle flows** | Stopper alle aktive traktorer i alle flows |
+| **Nyt run** | Opretter et nyt flow og hopper til fanen **Flows** |
+
+Statuslinjen viser bagefter, hvor mange flows og traktorer der blev startet, og op til tre grunde til
+traktorer, der blev sprunget over. Alle grunde står i `log.txt`.
+
Vælg flow i feltet **Run** øverst. Under tavlen står detaljerne for det valgte flow.
### Retning
@@ -478,7 +492,7 @@ kolonneoverskrifter øverst:
| Kolonne | Betydning |
|---|---|
-| **I bygningen** | Mængde og kapacitet i den valgte bygning samt fyldningsgrad |
+| **I bygningen** | Mængde og kapacitet i den valgte bygning samt fyldningsgrad. Palleskure viser paller af ledige pladser, fx `24/4000 paller 1 %` |
| **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 |
diff --git a/docs/USER_MANUAL.md b/docs/USER_MANUAL.md
index 71f8acc..8c2bd28 100644
--- a/docs/USER_MANUAL.md
+++ b/docs/USER_MANUAL.md
@@ -1,6 +1,6 @@
# AD Smart Pickup — user manual
-Version 1.19.10 · Farming Simulator 25 · add-on for AutoDrive
+Version 1.20.0 · Farming Simulator 25 · add-on for AutoDrive
*Dansk version: [BRUGERMANUAL.md](BRUGERMANUAL.md)*
@@ -139,6 +139,9 @@ The **Overview** tab shows all flows as a table with the columns **Flow**, **Goo
**Running** and **Status**. The selected flow is marked with `>`. Running shows tractors at work out of
the flow's tractors. Status shows a warning, the reason tractors are waiting, or the flow's rule.
+**Click a flow** in the table to jump straight to the **Flows** tab with that flow selected. The status
+line at the bottom shows how many tractors and flows are running in total.
+
Earlier the board was one long line per flow:
```
@@ -163,6 +166,17 @@ the same order.
| **Delete run** | Deletes the flow and stops its running tractors. Cannot be undone |
| **Start run / Stop run** | Starts or stops all tractors in the flow |
+On the **Overview** tab the buttons are instead:
+
+| Button | What it does |
+|---|---|
+| **Start all flows** | Starts every flow that has tractors. Flows already running are left alone, so no trip is interrupted |
+| **Stop all flows** | Stops all active tractors in all flows |
+| **New run** | Creates a new flow and jumps to the **Flows** tab |
+
+Afterwards the status line shows how many flows and tractors were started, plus up to three reasons for
+tractors that were skipped. All reasons are in `log.txt`.
+
Pick a flow in the **Run** field at the top. The details of the selected flow are shown below the board.
### Direction
@@ -484,7 +498,7 @@ one row per good:
| Column | Meaning |
|---|---|
-| **In building** | Amount and capacity in the selected building, plus fill level |
+| **In building** | Amount and capacity in the selected building, plus fill level. Pallet sheds show pallets out of free slots, such as `24/4000 pallets 1 %` |
| **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 |
diff --git a/tests/test_adRunsController.lua b/tests/test_adRunsController.lua
index 3802840..0f66022 100644
--- a/tests/test_adRunsController.lua
+++ b/tests/test_adRunsController.lua
@@ -770,5 +770,35 @@ do
check("PM forsyning tæller ikke", pickups[9999], nil)
end
+-- SA: Start/Stop alle flows — kørende flows røres ikke ved Start alle; Stop alle stopper alt aktivt
+do
+ buildWorld()
+ local idle = makeVehicle("vehicleAllA", "Alle A", {STRAW, TMR}, 1000000, 100, 0)
+ local busy = makeVehicle("vehicleAllB", "Alle B", {STRAW, TMR}, 1000000, 100, 0)
+ local runA = ADRunsController.createRun("Alle-A")
+ ADRunsController.updateRun(runA.id, {targetWayPointId = 94})
+ ADRunsController.assignVehicle(runA.id, idle)
+ local runB = ADRunsController.createRun("Alle-B")
+ ADRunsController.updateRun(runB.id, {targetWayPointId = 94})
+ ADRunsController.assignVehicle(runB.id, busy)
+ ADRunsController.createRun("Alle-tom") -- ingen traktorer: tæller ikke med
+ ADRunsController.startRun(adEnv, runB.id)
+ local busyStarts = busy.started
+ local summary = ADRunsController.startAllRuns(adEnv)
+ check("SA idle startet", idle.started, 1)
+ check("SA kørende flow ikke genstartet", busy.started, busyStarts)
+ check("SA mindst ét flow startet", summary.runsStarted >= 1, true)
+ check("SA kørende flow talt", summary.alreadyRunning >= 1, true)
+ check("SA traktorer startet tæller idle", summary.vehiclesStarted >= 1, true)
+ check("SA resultater med", type(summary.results), "table")
+ check("SA noget aktivt", ADRunsController.hasActiveRuns(adEnv), true)
+ local stopped = ADRunsController.stopAllRuns(adEnv)
+ check("SA stop alle stopper begge", stopped >= 2, true)
+ check("SA idle stoppet", idle.ad.stateModule.active, false)
+ check("SA busy stoppet", busy.ad.stateModule.active, false)
+ check("SA intet aktivt bagefter", ADRunsController.hasActiveRuns(adEnv), false)
+ check("SA isRunning ryddet", ADRunsController.getRunStatus(adEnv, ADRuns.getRun(ADRunsController.store, runA.id)).isRunning, false)
+end
+
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)
diff --git a/tests/test_adSources.lua b/tests/test_adSources.lua
index 83008e3..5b37613 100644
--- a/tests/test_adSources.lua
+++ b/tests/test_adSources.lua
@@ -323,6 +323,9 @@ check("S12 TMR-fabrik roer er input", beetEntry.isOutput, false)
check("S12 outputs først", byName["TMR-fabrik"].entries[1].isOutput, true)
check("S12 silo", byName["Farma"].entries[1].fillType, FORAGE)
check("S12 objektlager kurve som antal", byName["Objektlager"].entries[1].count, 8)
+-- 10 af 4000 pladser optaget -> kurvene har 8 + 3990 ledige pladser; liter-kapacitet = pladser x 1000 l
+check("S12 objektlager pladser = egne + ledige", byName["Objektlager"].entries[1].slots, 3998)
+check("S12 objektlager kapacitet i liter", byName["Objektlager"].entries[1].capacity, 3998000)
check("S12 stald halm", byName["Kostald"].entries[1].level, 2000)
check("S12 stald kapacitet = niveau + fri", byName["Kostald"].entries[1].capacity, 21375)
check("S12 tomt skur udeladt", byName["Fuldt skur"], nil)
diff --git a/tests/test_adStorageStats.lua b/tests/test_adStorageStats.lua
index 25506cb..315c032 100644
--- a/tests/test_adStorageStats.lua
+++ b/tests/test_adStorageStats.lua
@@ -70,5 +70,11 @@ check("ST9 stiger-flag", rising.rising, true)
check("ST1 falder -> ikke stiger", st.rising, false)
check("ST2 intet forbrug -> ikke stiger", st2.rising, false)
+-- ST3: palleskur — procent af PLADSER (24 paller af 4000), ikke liter mod pladsantal (600 %)
+local egg = S.itemStats({fillType = 8, level = 24000, capacity = 4000000, count = 24, slots = 4000}, 24000, nil, nil)
+check("ST3 paller med", egg.count, 24)
+check("ST3 pladser med", egg.slots, 4000)
+check("ST3 procent af pladser", egg.percent, 1)
+
print(failures == 0 and "\nALLE TESTS OK" or ("\n" .. failures .. " FEJL"))
os.exit(failures == 0 and 0 or 1)