feat(kæde): kæder slås selv til ([Kæde til]/[Fjern]); tomme kædeflows slettes; runsView med traktorer (v1.62.0.0)
This commit is contained in:
@@ -20,7 +20,7 @@ ADChainView.TEXT_ROW_CHARS = 70
|
||||
-- "stramt": lager for en mark-afgrøde under så mange måneders behov -> gul
|
||||
ADChainView.TIGHT_MONTHS = 3
|
||||
-- nøgler rækkerne bruger (til l10n-testen)
|
||||
ADChainView.TEXT_KEYS = {"spu_chain_finalFarm", "spu_chain_finalSell", "spu_chain_finalKeep", "spu_chain_suggestHeader", "spu_chain_empty", "spu_chain_approve", "spu_chain_dismiss", "spu_chain_auto",
|
||||
ADChainView.TEXT_KEYS = {"spu_chain_optIn", "spu_chain_optOut", "spu_chain_notChosen", "spu_chain_candidatesShow", "spu_chain_candidatesHide", "spu_chain_finalFarm", "spu_chain_finalSell", "spu_chain_finalKeep", "spu_chain_suggestHeader", "spu_chain_empty", "spu_chain_approve", "spu_chain_dismiss", "spu_chain_auto",
|
||||
"spu_chain_flowOk", "spu_chain_flowMissing", "spu_chain_flowPallet", "spu_chain_flowNone", "spu_chain_flowStopped", "spu_chain_bottleneck",
|
||||
"spu_chain_buy", "spu_chain_cycle", "spu_chain_fieldShort", "spu_chain_tight", "spu_chain_noField", "spu_chain_buySource", "spu_chain_fromFields",
|
||||
"spu_chain_pause", "spu_chain_resume", "spu_chain_scanning", "spu_chain_rootOk", "spu_chain_rootError", "spu_chain_rootWaiting",
|
||||
@@ -372,12 +372,27 @@ local function pausedRows(rows, last, ctx)
|
||||
if candidate.key == key then recipe = candidate end
|
||||
end
|
||||
local name = recipe ~= nil and recipe.name ~= nil and ctx.titleOf(recipe.name) or tostring(key)
|
||||
-- pauset kæde: [Start] genoptager, [Fjern] tager den ud af kæderne
|
||||
table.insert(rows, makeRow("root", 0, "stopped", {name, recipe ~= nil and tostring(recipe.buildingName or "") or "", "",
|
||||
ctx.textOf("spu_chain_rootPaused"), ctx.textOf("spu_chain_resume")}, {[5] = {kind = "resume", rootKey = key}}))
|
||||
ctx.textOf("spu_chain_optOut"), ctx.textOf("spu_chain_resume")},
|
||||
{[4] = {kind = "optOut", rootKey = key}, [5] = {kind = "resume", rootKey = key}}))
|
||||
end
|
||||
return #keys
|
||||
end
|
||||
|
||||
-- Tændte produktioner uden kæde: foldet sammen under én linje; udfoldet med [Kæde til] pr. produktion.
|
||||
local function candidateRows(rows, last, ctx, isExpanded)
|
||||
local list = last.candidates or {}
|
||||
if #list == 0 then return end
|
||||
local key = isExpanded and "spu_chain_candidatesHide" or "spu_chain_candidatesShow"
|
||||
table.insert(rows, makeRow("root", 0, nil, {(isExpanded and "– " or "+ ") .. string.format(ctx.textOf(key), #list), "", "", "", ""}, {}, "__candidates"))
|
||||
if not isExpanded then return end
|
||||
for _, candidate in ipairs(list) do
|
||||
table.insert(rows, makeRow("root", 1, nil, {ADChainView.INDENT .. ctx.titleOf(candidate.name), tostring(candidate.buildingName or ""), "",
|
||||
ctx.textOf("spu_chain_notChosen"), ctx.textOf("spu_chain_optIn")}, {[5] = {kind = "optIn", rootKey = candidate.key}}))
|
||||
end
|
||||
end
|
||||
|
||||
-- "Marker fri til kæden: F1, F2 +k" — så mange navne som tekstlinjen kan rumme, resten talt.
|
||||
function ADChainView.freeText(names, textOf)
|
||||
local format = textOf("spu_chain_free")
|
||||
@@ -430,6 +445,7 @@ function ADChainView.rows(last, titleOf, fmt, textOf, expanded)
|
||||
end
|
||||
for _, root in ipairs(ADChainView.sortRoots(roots, last)) do rootRows(rows, root, last, ctx, expanded[root.key] == true) end
|
||||
pausedRows(rows, last, ctx)
|
||||
candidateRows(rows, last, ctx, expanded["__candidates"] == true)
|
||||
footerRows(rows, last, textOf)
|
||||
return rows
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user