From 064849c860bede0fba4cd9642828738b9d4b5aba Mon Sep 17 00:00:00 2001 From: masterdraco Date: Wed, 23 Sep 2026 01:38:05 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20traktorer=20i=20et=20andet=20run=20vise?= =?UTF-8?q?s=20l=C3=A5st=20med=20run-navn=20i=20stedet=20for=20at=20kunne?= =?UTF-8?q?=20v=C3=A6lges=20(v1.9.7.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FS25_ADSmartPickup/gui/SmartPickupFrame.lua | 17 +++++++++++++---- FS25_ADSmartPickup/l10n/l10n_da.xml | 1 + FS25_ADSmartPickup/l10n/l10n_en.xml | 1 + FS25_ADSmartPickup/modDesc.xml | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua index 079f5d9..347bf4f 100644 --- a/FS25_ADSmartPickup/gui/SmartPickupFrame.lua +++ b/FS25_ADSmartPickup/gui/SmartPickupFrame.lua @@ -318,9 +318,18 @@ function SmartPickupFrame:fillVehicleRows(adEnv, run) for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do local id = ADRunsController.getVehicleId(vehicle) local row = self:addRow(self.vehiclePrefab, {kind = "vehicle", vehicle = vehicle, row = nil}) - self.rowData[row:getDescendantByName("option")].row = row - row:getDescendantByName("option"):setState(inRun[id] and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false) - row:getDescendantByName("title"):setText(self:describeVehicle(adEnv, run, vehicle, inRun[id])) + local option, title = row:getDescendantByName("option"), row:getDescendantByName("title") + self.rowData[option].row = row + option:setState(inRun[id] and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false) + -- Traktorer i et ANDET run kan ikke vælges her (én traktor = ét run); rækken viser hvor den er. + local otherRun = ADRunsController.getRunForVehicle(vehicle) + if otherRun ~= nil and otherRun.id ~= run.id then + option:setDisabled(true) + self.rowData[option].locked = true + title:setText(string.format("%s — %s", ADRunsController.getVehicleLabel(adEnv, vehicle), string.format(self.i18n:getText("spu_inRun"), tostring(otherRun.name)))) + else + title:setText(self:describeVehicle(adEnv, run, vehicle, inRun[id])) + end end end @@ -560,7 +569,7 @@ end function SmartPickupFrame:onClickVehicle(state, element) self:safe(function(frame) local run, data = frame:getRun(), frame.rowData[element] - if run == nil or data == nil then return end + if run == nil or data == nil or data.locked then return end if state == SmartPickupFrame.STATE_ON then local previousRunId = ADRunsController.assignVehicle(run.id, data.vehicle) if previousRunId ~= nil then diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml index 19f94a1..c631698 100644 --- a/FS25_ADSmartPickup/l10n/l10n_da.xml +++ b/FS25_ADSmartPickup/l10n/l10n_da.xml @@ -42,6 +42,7 @@ + diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml index 881d5f4..6ceaf91 100644 --- a/FS25_ADSmartPickup/l10n/l10n_en.xml +++ b/FS25_ADSmartPickup/l10n/l10n_en.xml @@ -42,6 +42,7 @@ + diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml index 8dd97ce..8954cae 100644 --- a/FS25_ADSmartPickup/modDesc.xml +++ b/FS25_ADSmartPickup/modDesc.xml @@ -1,7 +1,7 @@ masterdraco - 1.9.6.0 + 1.9.7.0 <en>AD Smart Pickup</en>