feat(flow-guide): listen over traktorer der ikke kan bruges er foldet sammen som standard; linjen med antallet folder ud/ind (v1.36.6.0)
This commit is contained in:
@@ -143,6 +143,13 @@ local function setPolicy(products, name, policy)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ADFlowGuide.choose(guide, id, value)
|
function ADFlowGuide.choose(guide, id, value)
|
||||||
|
if id == "showBlocked" then
|
||||||
|
-- visning, ikke en del af flowet: fold listen over traktorer der ikke kan bruges ud/ind
|
||||||
|
local copy = {}
|
||||||
|
for key, field in pairs(guide) do copy[key] = field end
|
||||||
|
copy.showBlocked = not guide.showBlocked
|
||||||
|
return copy
|
||||||
|
end
|
||||||
local draft = ADGuide.deepCopy(guide.draft)
|
local draft = ADGuide.deepCopy(guide.draft)
|
||||||
if SET_VALUES[id] then
|
if SET_VALUES[id] then
|
||||||
draft[id] = value
|
draft[id] = value
|
||||||
@@ -328,11 +335,14 @@ local function rowsTractors(guide)
|
|||||||
if #rows == 0 then table.insert(rows, text("spu_guide_flow_noTractors")) 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 other > 0 then table.insert(rows, text("spu_guide_flow_otherFlows", {other})) end
|
||||||
if blocked > 0 then
|
if blocked > 0 then
|
||||||
table.insert(rows, text("spu_guide_flow_blocked", {blocked}))
|
-- foldet sammen som standard; linjen med antallet folder navn + grund ud/ind
|
||||||
-- navn + grund (fx "X ingen vogn"), så man kan se hvorfor en traktor ikke kan vælges
|
local key = guide.showBlocked and "spu_guide_flow_blockedHide" or "spu_guide_flow_blockedShow"
|
||||||
|
table.insert(rows, {type = "link", id = "showBlocked", value = true, label = L(key, {blocked})})
|
||||||
|
if guide.showBlocked then
|
||||||
table.sort(blockedTexts)
|
table.sort(blockedTexts)
|
||||||
for _, line in ipairs(blockedTexts) do table.insert(rows, {type = "text", label = T(" " .. line)}) end
|
for _, line in ipairs(blockedTexts) do table.insert(rows, {type = "text", label = T(" " .. line)}) end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return rows
|
return rows
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -451,6 +451,8 @@
|
|||||||
<text name="spu_guide_flow_storeAutoText" text=" Lagerturene kører til nærmeste lager med plads."/>
|
<text name="spu_guide_flow_storeAutoText" text=" Lagerturene kører til nærmeste lager med plads."/>
|
||||||
<text name="spu_guide_flow_noTractors" text=" Ingen ledige traktorer"/>
|
<text name="spu_guide_flow_noTractors" text=" Ingen ledige traktorer"/>
|
||||||
<text name="spu_guide_flow_otherFlows" text=" %d traktorer kører i andre flows og vises ikke"/>
|
<text name="spu_guide_flow_otherFlows" text=" %d traktorer kører i andre flows og vises ikke"/>
|
||||||
|
<text name="spu_guide_flow_blockedShow" text=" %d traktorer kan ikke bruges her (vognen passer ikke) — klik for at se hvorfor"/>
|
||||||
|
<text name="spu_guide_flow_blockedHide" text=" %d traktorer kan ikke bruges her — klik for at skjule"/>
|
||||||
<text name="spu_guide_flow_blocked" text=" %d traktorer kan ikke bruges her (vognen passer ikke)"/>
|
<text name="spu_guide_flow_blocked" text=" %d traktorer kan ikke bruges her (vognen passer ikke)"/>
|
||||||
<text name="spu_guide_flow_none" text="ingen valgt"/>
|
<text name="spu_guide_flow_none" text="ingen valgt"/>
|
||||||
<text name="spu_guide_flow_goodsAuto" text="Automatisk"/>
|
<text name="spu_guide_flow_goodsAuto" text="Automatisk"/>
|
||||||
|
|||||||
@@ -451,6 +451,8 @@
|
|||||||
<text name="spu_guide_flow_storeAutoText" text=" Storage trips go to the nearest store with room."/>
|
<text name="spu_guide_flow_storeAutoText" text=" Storage trips go to the nearest store with room."/>
|
||||||
<text name="spu_guide_flow_noTractors" text=" No free tractors"/>
|
<text name="spu_guide_flow_noTractors" text=" No free tractors"/>
|
||||||
<text name="spu_guide_flow_otherFlows" text=" %d tractors run in other flows and are hidden"/>
|
<text name="spu_guide_flow_otherFlows" text=" %d tractors run in other flows and are hidden"/>
|
||||||
|
<text name="spu_guide_flow_blockedShow" text=" %d tractors cannot be used here (trailer does not fit) — click to see why"/>
|
||||||
|
<text name="spu_guide_flow_blockedHide" text=" %d tractors cannot be used here — click to hide"/>
|
||||||
<text name="spu_guide_flow_blocked" text=" %d tractors cannot be used here (trailer does not fit)"/>
|
<text name="spu_guide_flow_blocked" text=" %d tractors cannot be used here (trailer does not fit)"/>
|
||||||
<text name="spu_guide_flow_none" text="none chosen"/>
|
<text name="spu_guide_flow_none" text="none chosen"/>
|
||||||
<text name="spu_guide_flow_goodsAuto" text="Automatic"/>
|
<text name="spu_guide_flow_goodsAuto" text="Automatic"/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
<modDesc descVersion="107">
|
<modDesc descVersion="107">
|
||||||
<author>masterdraco</author>
|
<author>masterdraco</author>
|
||||||
<version>1.36.5.0</version>
|
<version>1.36.6.0</version>
|
||||||
<title>
|
<title>
|
||||||
<en>AD Smart Pickup</en>
|
<en>AD Smart Pickup</en>
|
||||||
</title>
|
</title>
|
||||||
|
|||||||
@@ -161,11 +161,25 @@ check("FL9 traktorer: kun egne + ledige", countType(tractorRows, "check"), 2)
|
|||||||
check("FL9 egne først", (function() for _, r in ipairs(tractorRows) do if r.type == "check" then return r.item end end end)(), "t4")
|
check("FL9 egne først", (function() for _, r in ipairs(tractorRows) do if r.type == "check" then return r.item end end end)(), "t4")
|
||||||
check("FL9 skjult andre flows", findRow(tractorRows, "vehicleIds", "t2"), nil)
|
check("FL9 skjult andre flows", findRow(tractorRows, "vehicleIds", "t2"), nil)
|
||||||
check("FL9 skjult blokeret", findRow(tractorRows, "vehicleIds", "t3"), nil)
|
check("FL9 skjult blokeret", findRow(tractorRows, "vehicleIds", "t3"), nil)
|
||||||
check("FL9 linjer", textKeys(tractorRows), "spu_guide_flow_otherFlows,spu_guide_flow_blocked")
|
check("FL9 linjer", textKeys(tractorRows), "spu_guide_flow_otherFlows")
|
||||||
-- in-game 27/9: en parkeret Lintrac dukkede ikke op og ingen kunne se hvorfor — blokerede står med navn + grund
|
-- blokerede traktorer: foldet sammen som standard (in-game 27/9: 37 linjer der ikke kunne bruges fyldte trinnet);
|
||||||
local blockedLine = nil
|
-- linjen med antallet er et link der folder navn + grund ud og ind
|
||||||
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
|
local function blockedLine(rows)
|
||||||
check("FL9 blokeret traktor vises med sin tekst", blockedLine ~= nil, true)
|
for _, r in ipairs(rows) do if r.type == "text" and r.label.text ~= nil and r.label.text:find("Traktor 3", 1, true) then return r end end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local function blockedLink(rows)
|
||||||
|
for _, r in ipairs(rows) do if r.type == "link" and r.id == "showBlocked" then return r end end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
check("FL9 blokerede foldet sammen som standard", blockedLine(tractorRows), nil)
|
||||||
|
check("FL9 link med antal", blockedLink(tractorRows) ~= nil and blockedLink(tractorRows).label.key, "spu_guide_flow_blockedShow")
|
||||||
|
local expanded = FG.choose(assigned, "showBlocked", true)
|
||||||
|
local expandedRows = FG.rows(at(expanded, "tractors"))
|
||||||
|
check("FL9 foldet ud viser navn + grund", blockedLine(expandedRows) ~= nil, true)
|
||||||
|
check("FL9 foldet ud: link skjuler igen", blockedLink(expandedRows).label.key, "spu_guide_flow_blockedHide")
|
||||||
|
check("FL9 fold ud ændrer ikke kladden", expanded.draft.vehicleIds[1], "t4")
|
||||||
|
check("FL9 fold sammen igen", blockedLine(FG.rows(at(FG.choose(expanded, "showBlocked", true), "tractors"))), nil)
|
||||||
local inThisRun = FG.open(newRun("supply"), ctx({vehicles = {{id = "t2", text = "T2", otherRunId = 1, otherRunName = "Mælk ud"}}}))
|
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)
|
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