From 780b6a0daa700ad51d7e4c42f341bfc17cfd378a Mon Sep 17 00:00:00 2001 From: masterdraco Date: Sat, 26 Sep 2026 19:01:58 +0200 Subject: [PATCH] =?UTF-8?q?fix(gui):=20marktabellens=20status=20er=20kort?= =?UTF-8?q?=20(trin=20+=20kort=20=C3=A5rsag,=20fx=20'G=C3=B8dskning:=20bre?= =?UTF-8?q?dde=20ukendt');=20hele=20forklaringen=20st=C3=A5r=20i=20markens?= =?UTF-8?q?=20detaljer;=20kortere=20hint=20(v1.30.2.0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gui/SmartPickupFieldTab.lua | 25 +++++++++++++++++-- FS25_ADSmartPickup/l10n/l10n_da.xml | 13 +++++++++- FS25_ADSmartPickup/l10n/l10n_en.xml | 13 +++++++++- FS25_ADSmartPickup/modDesc.xml | 2 +- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/FS25_ADSmartPickup/gui/SmartPickupFieldTab.lua b/FS25_ADSmartPickup/gui/SmartPickupFieldTab.lua index a5f8828..fdd467d 100644 --- a/FS25_ADSmartPickup/gui/SmartPickupFieldTab.lua +++ b/FS25_ADSmartPickup/gui/SmartPickupFieldTab.lua @@ -53,11 +53,32 @@ function SmartPickupFrame:soilText(info) return table.concat(texts, ", ") end -function SmartPickupFrame:fieldStatusText(field, info) +-- Kort årsag til tabellens statuskolonne ("bredde ukendt" i stedet for hele forklaringen, som står i +-- markens detaljer). Fritekst-årsager (fx "… er tom for X") forkortes til "se detaljer". +function SmartPickupFrame:fieldReasonShort(reason) + if type(reason) ~= "table" then return nil end + if reason.text ~= nil then return self.i18n:getText("spu_field_reasonShort_text") end + local shortKey = reason.key ~= nil and string.gsub(reason.key, "^spu_field_reason_", "spu_field_reasonShort_") or nil + if shortKey ~= nil then + local okHas, has = pcall(function() return self.i18n.hasText == nil or self.i18n:hasText(shortKey) end) + if okHas and has then return self.i18n:getText(shortKey) end + end + return self:fieldReasonText(reason) +end + +-- short = tabellens korte udgave (trin + kort årsag); ellers hele teksten (markens detaljer). +function SmartPickupFrame:fieldStatusText(field, info, short) local text = self.i18n:getText(ADFieldView.statusKey(field, info)) if info.markerId == nil then return string.format(text, info.id) end + if short then + if (field.stage == "idle" or field.stage == "ready") and info.kind ~= "bare" and info.readyRatio ~= nil then + text = string.format("%s %d %%", text, math.floor((info.readyRatio or 0) * 100 + 0.5)) + end + local reason = self:fieldReasonShort(field.reason) + return reason ~= nil and (text .. ": " .. reason) or text + end if (field.stage == "idle" or field.stage == "ready") and info.kind ~= "bare" and info.readyRatio ~= nil then text = string.format("%s %d %%", text, math.floor((info.readyRatio or 0) * 100 + 0.5)) end @@ -113,7 +134,7 @@ function SmartPickupFrame:fieldCells(row) return { name, crop, self:fieldPlanText(field, info), self.i18n:getText(field.plan.mode == "auto" and "spu_field_mode_auto" or "spu_field_mode_manual"), - self:fieldStatusText(field, info), + self:fieldStatusText(field, info, true), ADFlowView.joinCounted(names, ", ", "-"), } end diff --git a/FS25_ADSmartPickup/l10n/l10n_da.xml b/FS25_ADSmartPickup/l10n/l10n_da.xml index a64c979..3546aea 100644 --- a/FS25_ADSmartPickup/l10n/l10n_da.xml +++ b/FS25_ADSmartPickup/l10n/l10n_da.xml @@ -51,6 +51,17 @@ + + + + + + + + + + + @@ -66,7 +77,7 @@ - + diff --git a/FS25_ADSmartPickup/l10n/l10n_en.xml b/FS25_ADSmartPickup/l10n/l10n_en.xml index 38fc1b5..1f6fe64 100644 --- a/FS25_ADSmartPickup/l10n/l10n_en.xml +++ b/FS25_ADSmartPickup/l10n/l10n_en.xml @@ -51,6 +51,17 @@ + + + + + + + + + + + @@ -66,7 +77,7 @@ - + diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml index bccc863..e70b9ff 100644 --- a/FS25_ADSmartPickup/modDesc.xml +++ b/FS25_ADSmartPickup/modDesc.xml @@ -1,7 +1,7 @@ masterdraco - 1.30.1.0 + 1.30.2.0 <en>AD Smart Pickup</en>