feat(flow-guide): traktorer der ikke kan bruges i flowet vises med navn og grund (før kun et antal); fejl ved opbygning af traktorlisten logges i stedet for at skjule traktoren (v1.36.2.0)
This commit is contained in:
@@ -307,6 +307,7 @@ local function rowsTractors(guide)
|
||||
local inRun = chosenSet(draft.vehicleIds)
|
||||
local entries = {}
|
||||
local other, blocked = 0, 0
|
||||
local blockedTexts = {}
|
||||
for _, vehicle in ipairs(guide.context.vehicles or {}) do
|
||||
local state = "free"
|
||||
if inRun[vehicle.id] then
|
||||
@@ -317,6 +318,7 @@ local function rowsTractors(guide)
|
||||
elseif vehicle.blocked then
|
||||
state = "blocked"
|
||||
blocked = blocked + 1
|
||||
table.insert(blockedTexts, tostring(vehicle.text))
|
||||
end
|
||||
table.insert(entries, {id = vehicle.id, label = tostring(vehicle.text), state = state})
|
||||
end
|
||||
@@ -325,7 +327,12 @@ local function rowsTractors(guide)
|
||||
end
|
||||
if #rows == 0 then table.insert(rows, text("spu_guide_flow_noTractors")) end
|
||||
if other > 0 then table.insert(rows, text("spu_guide_flow_otherFlows", {other})) end
|
||||
if blocked > 0 then table.insert(rows, text("spu_guide_flow_blocked", {blocked})) end
|
||||
if blocked > 0 then
|
||||
table.insert(rows, text("spu_guide_flow_blocked", {blocked}))
|
||||
-- navn + grund (fx "X ingen vogn"), så man kan se hvorfor en traktor ikke kan vælges
|
||||
table.sort(blockedTexts)
|
||||
for _, line in ipairs(blockedTexts) do table.insert(rows, {type = "text", label = T(" " .. line)}) end
|
||||
end
|
||||
return rows
|
||||
end
|
||||
|
||||
|
||||
@@ -117,7 +117,12 @@ function SmartPickupFrame:flowVehicleContext(adEnv, preview)
|
||||
return {id = ADRunsController.getVehicleId(vehicle), text = text, label = ADRunsController.getVehicleLabel(adEnv, vehicle), otherRunId = other ~= nil and other.id or nil,
|
||||
otherRunName = other ~= nil and other.name or nil, blocked = SmartPickupFrame.VEHICLE_BLOCKING_REASONS[validation.reason] == true}
|
||||
end)
|
||||
if ok and entry.id ~= nil then table.insert(result, entry) end
|
||||
if ok and entry.id ~= nil then
|
||||
table.insert(result, entry)
|
||||
elseif not ok then
|
||||
Logging.warning(SmartPickupFrame.LOG_PREFIX .. "traktor '%s' kunne ikke vises i flowets traktorliste: %s",
|
||||
tostring(vehicle.getName ~= nil and vehicle:getName() or "?"), tostring(entry))
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.36.1.0</version>
|
||||
<version>1.36.2.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
@@ -162,6 +162,10 @@ check("FL9 egne først", (function() for _, r in ipairs(tractorRows) do if r.typ
|
||||
check("FL9 skjult andre flows", findRow(tractorRows, "vehicleIds", "t2"), nil)
|
||||
check("FL9 skjult blokeret", findRow(tractorRows, "vehicleIds", "t3"), nil)
|
||||
check("FL9 linjer", textKeys(tractorRows), "spu_guide_flow_otherFlows,spu_guide_flow_blocked")
|
||||
-- in-game 27/9: en parkeret Lintrac dukkede ikke op og ingen kunne se hvorfor — blokerede står med navn + grund
|
||||
local blockedLine = nil
|
||||
for _, r in ipairs(tractorRows) do if r.type == "text" and r.label.text ~= nil and r.label.text:find("Traktor 3", 1, true) then blockedLine = r end end
|
||||
check("FL9 blokeret traktor vises med sin tekst", blockedLine ~= nil, true)
|
||||
local inThisRun = FG.open(newRun("supply"), ctx({vehicles = {{id = "t2", text = "T2", otherRunId = 1, otherRunName = "Mælk ud"}}}))
|
||||
check("FL9 traktor i dette flow er ikke 'andet flow'", countType(FG.rows(at(inThisRun, "tractors")), "check"), 1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user