diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
index 1adfa67..f4c1654 100644
--- a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
+++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua
@@ -147,6 +147,14 @@ function SmartPickupFrame:setStatusText(text)
end
end
+-- ESC-menuen kalder ikke altid update() på siden, så genopbygningen sker straks. De
+-- elementer der udløser den (Run/Mål/Varer-tilstand, knapperne) er statiske og slettes
+-- ikke af rebuild, så det er sikkert; pendingRebuild er kun bagstopper.
+function SmartPickupFrame:requestRebuild()
+ self.pendingRebuild = false
+ self:safe(self.rebuild)
+end
+
function SmartPickupFrame:getRun()
return self.selectedRunId ~= nil and ADRuns.getRun(ADRunsController.store, self.selectedRunId) or nil
end
@@ -314,16 +322,18 @@ function SmartPickupFrame:fillVehicleRows(adEnv, run)
end
-- "Fastrac 2135 4WS (#1) — 1.000.000 l — ✔" / "… — ✖ ingen vogn"; reservationsnote fra Start bevares.
+-- "Fastrac 2135 4WS (#1) — 1.000.000 l — kan bære: Halm, TMR — ✔" / "… — ✖ ingen vogn".
+-- Vises for ALLE traktorer, så man kan se om vognen passer, før man siger Ja.
function SmartPickupFrame:describeVehicle(adEnv, run, vehicle, isInRun)
local label = ADRunsController.getVehicleLabel(adEnv, vehicle)
- if not isInRun then
- return label
- end
local validation = ADRunsController.validateVehicle(adEnv, run, vehicle)
- local capacity = validation.capacity ~= nil and string.format(self.i18n:getText("spu_capacity"), g_i18n:formatNumber(validation.capacity, 0)) or nil
local parts = {label}
- if capacity ~= nil then
- table.insert(parts, capacity)
+ if validation.capacity ~= nil then
+ table.insert(parts, string.format(self.i18n:getText("spu_capacity"), g_i18n:formatNumber(validation.capacity, 0)))
+ local carriable = self:describeCarriable(adEnv, run, vehicle, validation.carriable)
+ if carriable ~= nil then
+ table.insert(parts, carriable)
+ end
end
if validation.ok then
table.insert(parts, "✔")
@@ -333,6 +343,25 @@ function SmartPickupFrame:describeVehicle(adEnv, run, vehicle, isInRun)
return table.concat(parts, " — ")
end
+-- Hvilke af run'ets varer vognen kan bære (titler); nil når ingen.
+function SmartPickupFrame:describeCarriable(adEnv, run, vehicle, carriable)
+ local canCarry = {}
+ for _, fillType in ipairs(carriable or {}) do
+ canCarry[fillType] = true
+ end
+ local titles = {}
+ for _, fillType in ipairs(ADRunsController.getRunIngredients(adEnv, run, vehicle)) do
+ if canCarry[fillType] then
+ local title = g_fillTypeManager.getFillTypeTitleByIndex ~= nil and g_fillTypeManager:getFillTypeTitleByIndex(fillType) or nil
+ table.insert(titles, tostring(title or g_fillTypeManager:getFillTypeNameByIndex(fillType)))
+ end
+ end
+ if #titles == 0 then
+ return nil
+ end
+ return string.format(self.i18n:getText("spu_canCarry"), table.concat(titles, ", "))
+end
+
function SmartPickupFrame:fillPoolRows(adEnv)
if adEnv == nil then
return
@@ -382,8 +411,10 @@ function SmartPickupFrame:refreshLive()
or string.format(self.i18n:getText("spu_status_stopped"), status.total)
self:setStatusText(self.statusOverride or text)
for option, data in pairs(self.rowData) do
- if data.kind == "vehicle" and data.row ~= nil then
- data.row:getDescendantByName("title"):setText(self:describeVehicle(adEnv, run, data.vehicle, SmartPickupFrame.getOptionState(option) == SmartPickupFrame.STATE_ON))
+ -- kun run'ets egne traktorer opdateres live (alle valideres ved rebuild)
+ local isInRun = SmartPickupFrame.getOptionState(option) == SmartPickupFrame.STATE_ON
+ if data.kind == "vehicle" and data.row ~= nil and isInRun then
+ data.row:getDescendantByName("title"):setText(self:describeVehicle(adEnv, run, data.vehicle, true))
end
end
else
@@ -404,7 +435,7 @@ end
function SmartPickupFrame:onClickRun(state)
self.selectedRunId = self.runIds[state]
self.statusOverride = nil
- self.pendingRebuild = true
+ self:requestRebuild()
end
function SmartPickupFrame:onClickTarget(state)
@@ -413,7 +444,7 @@ function SmartPickupFrame:onClickTarget(state)
if run == nil then return end
-- targetIds[1] er false = "(vælg mål)"; modellen tolker false som "ryd målet"
ADRunsController.updateRun(run.id, {targetWayPointId = frame.targetIds[state] or false})
- frame.pendingRebuild = true
+ frame:requestRebuild()
end)
end
@@ -422,7 +453,7 @@ function SmartPickupFrame:onClickIngredientMode(state)
local run = frame:getRun()
if run == nil then return end
ADRunsController.updateRun(run.id, {ingredientMode = state == SmartPickupFrame.STATE_ON and "manual" or "auto"})
- frame.pendingRebuild = true
+ frame:requestRebuild()
end)
end
@@ -491,7 +522,7 @@ function SmartPickupFrame:onClickStartStop()
frame.statusOverride = string.format(frame.i18n:getText("spu_status_started"), started, skipped)
end
ADRunsController.save()
- frame.pendingRebuild = true
+ frame:requestRebuild()
end)
end
@@ -501,7 +532,7 @@ function SmartPickupFrame:onClickNew()
local run = ADRunsController.createRun(string.format(frame.i18n:getText("spu_newRunName"), ADRunsController.store.nextId))
frame.selectedRunId = run.id
frame.statusOverride = nil
- frame.pendingRebuild = true
+ frame:requestRebuild()
end)
end
@@ -520,7 +551,7 @@ function SmartPickupFrame:onRenameResult(value, clickOk)
local run = frame:getRun()
if clickOk and run ~= nil and value ~= nil and value:match("%S") then
ADRunsController.updateRun(run.id, {name = value})
- frame.pendingRebuild = true
+ frame:requestRebuild()
end
end)
end
@@ -540,7 +571,7 @@ function SmartPickupFrame:onDeleteResult(yes)
if yes and run ~= nil then
ADRunsController.deleteRun(run.id)
frame.selectedRunId = nil
- frame.pendingRebuild = true
+ frame:requestRebuild()
end
end)
end
diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml
index e78b0fa..4b062c1 100644
--- a/FS25_ADSmartPickup/l10n/l10n_da.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_da.xml
@@ -42,5 +42,6 @@
+
diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml
index 1ec52db..cafe899 100644
--- a/FS25_ADSmartPickup/l10n/l10n_en.xml
+++ b/FS25_ADSmartPickup/l10n/l10n_en.xml
@@ -42,5 +42,6 @@
+
diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml
index 33dd0ad..928bd75 100644
--- a/FS25_ADSmartPickup/modDesc.xml
+++ b/FS25_ADSmartPickup/modDesc.xml
@@ -1,7 +1,7 @@
masterdraco
- 1.9.2.0
+ 1.9.3.0
AD Smart Pickup