feat(gui): guiden "Opsæt flow" — Flows-fanen får tavle + resumé (klik = ret ét trin, Navn = omdøb) og trin-for-trin-guide på samme ramme som markguiden; Nyt flow oprettes først ved Gem (v1.32.0.0)
This commit is contained in:
@@ -0,0 +1,447 @@
|
||||
-- AD Flow Guide
|
||||
-- "Opsæt flow": flowguidens trin oven på ADGuide (ren Lua, ingen spil-API) — samme trin-skærm og knapper
|
||||
-- som markguiden. Kladden er en kopi af flowets felter, så intet ændres før [Gem]/[Start flow]. Det
|
||||
-- spil-afhængige kommer i `context` (GUI'et henter det ud fra kladden, se previewRun):
|
||||
-- {buildings = {{id, name, label, hasMarker, text}} -- kandidater til Fra (udkørsel) / Til (forsyning)
|
||||
-- fillTypes = {{name, title}} -- varer målet tager (forsyning, Vælg selv)
|
||||
-- products = {{name, title}} -- varer kilderne har (udkørsel)
|
||||
-- storeBuildings = {{id, name, text}} -- lagre der kan tage flowets lagervarer
|
||||
-- waitPools = {{group, count}}
|
||||
-- vehicles = {{id, label, text, otherRunId, otherRunName, blocked}}} -- label = kort navn (resumé)
|
||||
-- Gem: ADRunsController.createRun/updateRun + assignVehicle/unassignVehicle (GUI'et).
|
||||
|
||||
ADFlowGuide = {}
|
||||
|
||||
ADFlowGuide.ORDER = {"name", "direction", "buildings", "goods", "store", "rules", "wait", "tractors", "summary"}
|
||||
ADFlowGuide.POLICIES = {"off", "store", "sell", "sellElseStore"}
|
||||
ADFlowGuide.MAX_NAMED_TRACTORS = 3
|
||||
ADFlowGuide.MAX_NAMED_GOODS = 3
|
||||
|
||||
local function L(key, args) return {key = key, args = args} end
|
||||
local function T(text) return {text = text} end
|
||||
|
||||
local function isOut(guide) return guide.draft.kind == "outbound" end
|
||||
|
||||
local function hasStorePolicy(draft)
|
||||
for _, product in ipairs(draft.products or {}) do
|
||||
if product.policy == "store" or product.policy == "sellElseStore" then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local VISIBLE = {
|
||||
name = function(guide) return guide.draft.isNew == true end,
|
||||
store = function(guide) return isOut(guide) and hasStorePolicy(guide.draft) end,
|
||||
}
|
||||
|
||||
function ADFlowGuide.isVisible(step, guide)
|
||||
local rule = VISIBLE[step]
|
||||
if rule ~= nil then return rule(guide) == true end
|
||||
for _, id in ipairs(ADFlowGuide.ORDER) do
|
||||
if id == step then return true end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
ADFlowGuide.DEF = {order = ADFlowGuide.ORDER, isVisible = ADFlowGuide.isVisible}
|
||||
|
||||
-- Overskrift pr. trin; "Fra"/"Til" følger retningen.
|
||||
function ADFlowGuide.stepKey(step, guide)
|
||||
if step == "buildings" then
|
||||
return (guide ~= nil and isOut(guide)) and "spu_guide_flow_step_from" or "spu_guide_flow_step_to"
|
||||
end
|
||||
return "spu_guide_flow_step_" .. tostring(step)
|
||||
end
|
||||
|
||||
local KIND_HINTS = {buildings = true, goods = true, rules = true}
|
||||
function ADFlowGuide.hintKey(step, guide)
|
||||
if KIND_HINTS[step] then
|
||||
return "spu_guide_flow_hint_" .. step .. ((guide ~= nil and isOut(guide)) and "_out" or "_in")
|
||||
end
|
||||
return "spu_guide_flow_hint_" .. tostring(step)
|
||||
end
|
||||
|
||||
-- ---- kladde ----
|
||||
|
||||
local RUN_FIELDS = {
|
||||
"id", "name", "kind", "sourceBuildingIds", "targetBuildingIds", "storeBuildingIds", "products",
|
||||
"ingredientMode", "ingredients", "sellAtPercent", "storeAbovePercent", "collectRound", "loops",
|
||||
"returnBelowPercent", "waitPoolGroup", "vehicleIds",
|
||||
}
|
||||
|
||||
local function draftFrom(run, isNew)
|
||||
local draft = {}
|
||||
for _, key in ipairs(RUN_FIELDS) do draft[key] = ADGuide.deepCopy(run[key]) end
|
||||
for _, key in ipairs({"sourceBuildingIds", "targetBuildingIds", "storeBuildingIds", "products", "ingredients", "vehicleIds"}) do
|
||||
draft[key] = draft[key] or {}
|
||||
end
|
||||
draft.kind = draft.kind == "outbound" and "outbound" or "supply"
|
||||
draft.ingredientMode = draft.ingredientMode == "manual" and "manual" or "auto"
|
||||
draft.sellAtPercent = draft.sellAtPercent or ADRuns.DEFAULT_SELL_AT_PERCENT
|
||||
draft.storeAbovePercent = draft.storeAbovePercent or ADRuns.DEFAULT_STORE_ABOVE_PERCENT
|
||||
draft.returnBelowPercent = draft.returnBelowPercent or ADRuns.DEFAULT_RETURN_BELOW_PERCENT
|
||||
draft.loops = draft.loops or 0
|
||||
draft.waitPoolGroup = draft.waitPoolGroup or ""
|
||||
draft.collectRound = draft.collectRound == true
|
||||
draft.isNew = isNew == true
|
||||
draft.showAllBuildings = false
|
||||
draft.storeAuto = #draft.storeBuildingIds == 0
|
||||
return draft
|
||||
end
|
||||
|
||||
function ADFlowGuide.open(run, context, options)
|
||||
return ADGuide.new(ADFlowGuide.DEF, draftFrom(run, false), context, options)
|
||||
end
|
||||
|
||||
-- Nyt flow: intet oprettes før [Gem]; kladden har standardværdierne fra ADRuns.createRun.
|
||||
function ADFlowGuide.openNew(name, context)
|
||||
local _, run = ADRuns.createRun(ADRuns.newStore(), name, "supply")
|
||||
local draft = draftFrom(run, true)
|
||||
draft.id = nil
|
||||
return ADGuide.new(ADFlowGuide.DEF, draft, context)
|
||||
end
|
||||
|
||||
-- Run-formet tabel til controllerens opslag (varer, vogne) før noget er gemt: markører fra de valgte
|
||||
-- bygninger. markerIds(buildingId, role) -> {wayPointId, ...}.
|
||||
function ADFlowGuide.previewRun(draft, markerIds)
|
||||
local run = ADGuide.deepCopy(draft)
|
||||
local function resolve(ids, role)
|
||||
local result, seen = {}, {}
|
||||
for _, buildingId in ipairs(ids or {}) do
|
||||
for _, wayPointId in ipairs(markerIds(buildingId, role) or {}) do
|
||||
if not seen[wayPointId] then
|
||||
seen[wayPointId] = true
|
||||
table.insert(result, wayPointId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
run.sourceWayPointIds = resolve(draft.sourceBuildingIds, "load")
|
||||
run.targetWayPointIds = resolve(draft.targetBuildingIds, "unload")
|
||||
run.targetWayPointId = run.targetWayPointIds[1]
|
||||
return run
|
||||
end
|
||||
|
||||
-- ---- valg ----
|
||||
|
||||
local SET_VALUES = {
|
||||
kind = true, ingredientMode = true, sellAtPercent = true, storeAbovePercent = true, loops = true,
|
||||
returnBelowPercent = true, waitPoolGroup = true,
|
||||
}
|
||||
local BOOL_VALUES = {showAllBuildings = true, storeAuto = true, collectRound = true}
|
||||
local LIST_VALUES = {ingredients = true, storeBuildingIds = true, vehicleIds = true}
|
||||
|
||||
local function setPolicy(products, name, policy)
|
||||
local result = {}
|
||||
for _, product in ipairs(products or {}) do
|
||||
if product.fillType ~= name then table.insert(result, {fillType = product.fillType, policy = product.policy}) end
|
||||
end
|
||||
if policy ~= "off" then table.insert(result, {fillType = name, policy = policy}) end
|
||||
return result
|
||||
end
|
||||
|
||||
function ADFlowGuide.choose(guide, id, value)
|
||||
local draft = ADGuide.deepCopy(guide.draft)
|
||||
if SET_VALUES[id] then
|
||||
draft[id] = value
|
||||
elseif BOOL_VALUES[id] then
|
||||
draft[id] = value == true
|
||||
elseif LIST_VALUES[id] then
|
||||
draft[id] = ADGuide.toggleItem(draft[id], value.item, value.on)
|
||||
elseif id == "buildings" then
|
||||
local key = draft.kind == "outbound" and "sourceBuildingIds" or "targetBuildingIds"
|
||||
draft[key] = ADGuide.toggleItem(draft[key], value.item, value.on)
|
||||
elseif id == "policy" then
|
||||
draft.products = setPolicy(draft.products, value.item, value.value)
|
||||
elseif id == "name" then
|
||||
if type(value) ~= "string" or not value:match("%S") then return guide end
|
||||
draft.name = value
|
||||
else
|
||||
return guide
|
||||
end
|
||||
return ADGuide.withDraft(guide, draft)
|
||||
end
|
||||
|
||||
-- ---- rækker ----
|
||||
|
||||
local function choice(id, title, options, value, item)
|
||||
return {type = "choice", id = id, title = title, options = options, value = value, item = item}
|
||||
end
|
||||
|
||||
local function toggle(id, title, value)
|
||||
return {type = "toggle", id = id, title = title, off = L("ui_no"), on = L("ui_yes"), value = value == true}
|
||||
end
|
||||
|
||||
local function check(id, item, text, value)
|
||||
return {type = "check", id = id, item = item, title = T(text), value = value == true}
|
||||
end
|
||||
|
||||
local function text(key, args) return {type = "text", label = L(key, args)} end
|
||||
|
||||
local function percentOptions(from, to, step)
|
||||
local options = {}
|
||||
for percent = from, to, step do table.insert(options, {label = T(string.format("%d %%", percent)), value = percent}) end
|
||||
return options
|
||||
end
|
||||
|
||||
local function chosenSet(list)
|
||||
local set = {}
|
||||
for _, value in ipairs(list or {}) do set[value] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
local function buildingIds(draft)
|
||||
return draft.kind == "outbound" and draft.sourceBuildingIds or draft.targetBuildingIds
|
||||
end
|
||||
|
||||
local function rowsName(guide)
|
||||
return {
|
||||
{type = "text", label = T(guide.draft.name or "")},
|
||||
{type = "link", id = "rename", value = true, label = L("spu_guide_flow_rename")},
|
||||
}
|
||||
end
|
||||
|
||||
local function rowsDirection(guide)
|
||||
return {choice("kind", L("spu_direction"), {
|
||||
{label = L("spu_direction_in"), value = "supply"}, {label = L("spu_direction_out"), value = "outbound"}}, guide.draft.kind)}
|
||||
end
|
||||
|
||||
-- Bygninger i fast rækkefølge (navn, markør); uden markør kun med "Vis alle" (eller når valgt).
|
||||
local function rowsBuildings(guide)
|
||||
local draft, rows = guide.draft, {}
|
||||
local chosen = chosenSet(buildingIds(draft))
|
||||
local candidates = guide.context.buildings or {}
|
||||
local shown = ADFlowView.buildingRows(candidates, chosen, draft.showAllBuildings)
|
||||
local hidden = ADFlowView.hiddenCount(candidates, shown)
|
||||
if hidden > 0 or draft.showAllBuildings then
|
||||
table.insert(rows, toggle("showAllBuildings", L("spu_showAllBuildings", {hidden}), draft.showAllBuildings))
|
||||
end
|
||||
for _, building in ipairs(shown) do
|
||||
table.insert(rows, check("buildings", building.id, building.text or building.name, chosen[building.id]))
|
||||
end
|
||||
if #shown == 0 then table.insert(rows, text("spu_noBuildings")) end
|
||||
return rows
|
||||
end
|
||||
|
||||
local function rowsGoods(guide)
|
||||
local draft, context, rows = guide.draft, guide.context, {}
|
||||
if isOut(guide) then
|
||||
local products = context.products or {}
|
||||
if #products == 0 then return {text("spu_guide_flow_noProducts")} end
|
||||
local options = {}
|
||||
for _, policy in ipairs(ADFlowGuide.POLICIES) do table.insert(options, {label = L("spu_policy_" .. policy), value = policy}) end
|
||||
for _, product in ipairs(products) do
|
||||
table.insert(rows, choice("policy", T(product.text or product.title), options, ADRuns.getProductPolicy(draft, product.name), product.name))
|
||||
end
|
||||
return rows
|
||||
end
|
||||
table.insert(rows, choice("ingredientMode", L("spu_guide_flow_goods"), {
|
||||
{label = L("spu_guide_flow_goodsAutoChoice"), value = "auto"}, {label = L("spu_guide_manual"), value = "manual"}}, draft.ingredientMode))
|
||||
if draft.ingredientMode ~= "manual" then
|
||||
table.insert(rows, text("spu_guide_flow_goodsAutoText"))
|
||||
return rows
|
||||
end
|
||||
local chosen = chosenSet(draft.ingredients)
|
||||
for _, fillType in ipairs(context.fillTypes or {}) do
|
||||
table.insert(rows, check("ingredients", fillType.name, " " .. tostring(fillType.title), chosen[fillType.name]))
|
||||
end
|
||||
if #(context.fillTypes or {}) == 0 then table.insert(rows, text("spu_guide_flow_noGoodsTo")) end
|
||||
return rows
|
||||
end
|
||||
|
||||
local function rowsStore(guide)
|
||||
local draft, rows = guide.draft, {}
|
||||
table.insert(rows, choice("storeAuto", L("spu_guide_store"), {
|
||||
{label = L("spu_guide_flow_storeAutoChoice"), value = true}, {label = L("spu_guide_manual"), value = false}}, draft.storeAuto))
|
||||
if draft.storeAuto then
|
||||
table.insert(rows, text("spu_guide_flow_storeAutoText"))
|
||||
return rows
|
||||
end
|
||||
local chosen = chosenSet(draft.storeBuildingIds)
|
||||
for _, building in ipairs(guide.context.storeBuildings or {}) do
|
||||
table.insert(rows, check("storeBuildingIds", building.id, building.text, chosen[building.id]))
|
||||
end
|
||||
if #(guide.context.storeBuildings or {}) == 0 then table.insert(rows, text("spu_noBuildings")) end
|
||||
return rows
|
||||
end
|
||||
|
||||
local function rowsRules(guide)
|
||||
local draft = guide.draft
|
||||
if isOut(guide) then
|
||||
return {
|
||||
choice("sellAtPercent", L("spu_sellAt"), percentOptions(ADRuns.MIN_SELL_AT_PERCENT, ADRuns.MAX_SELL_AT_PERCENT, 5), draft.sellAtPercent),
|
||||
choice("storeAbovePercent", L("spu_storeAbove"), percentOptions(ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT, 5), draft.storeAbovePercent),
|
||||
toggle("collectRound", L("spu_collectRound"), draft.collectRound),
|
||||
}
|
||||
end
|
||||
local loops = {{label = L("spu_loops_infinite"), value = 0}}
|
||||
for count = 1, ADRuns.MAX_LOOPS do table.insert(loops, {label = T(tostring(count)), value = count}) end
|
||||
return {
|
||||
choice("loops", L("spu_loops"), loops, draft.loops),
|
||||
choice("returnBelowPercent", L("spu_returnBelow"), percentOptions(ADRuns.MIN_RETURN_BELOW_PERCENT, ADRuns.MAX_RETURN_BELOW_PERCENT, 10), draft.returnBelowPercent),
|
||||
}
|
||||
end
|
||||
|
||||
local function rowsWait(guide)
|
||||
local options = {{label = L("spu_waitPool_all"), value = ""}}
|
||||
for _, pool in ipairs(guide.context.waitPools or {}) do
|
||||
table.insert(options, {label = T(string.format("%s (%d)", tostring(pool.group), pool.count or 0)), value = pool.group})
|
||||
end
|
||||
return {choice("waitPoolGroup", L("spu_waitPool"), options, guide.draft.waitPoolGroup or "")}
|
||||
end
|
||||
|
||||
-- Traktorer: flowets egne først, så de ledige. Traktorer i andre flows og blokerede (vognen passer ikke)
|
||||
-- skjules med en linje hver.
|
||||
local function rowsTractors(guide)
|
||||
local draft, rows = guide.draft, {}
|
||||
local inRun = chosenSet(draft.vehicleIds)
|
||||
local entries = {}
|
||||
local other, blocked = 0, 0
|
||||
for _, vehicle in ipairs(guide.context.vehicles or {}) do
|
||||
local state = "free"
|
||||
if inRun[vehicle.id] then
|
||||
state = "in"
|
||||
elseif vehicle.otherRunId ~= nil and vehicle.otherRunId ~= draft.id then
|
||||
state = "other"
|
||||
other = other + 1
|
||||
elseif vehicle.blocked then
|
||||
state = "blocked"
|
||||
blocked = blocked + 1
|
||||
end
|
||||
table.insert(entries, {id = vehicle.id, label = tostring(vehicle.text), state = state})
|
||||
end
|
||||
for _, entry in ipairs(ADFlowView.vehicleRows(entries, false)) do
|
||||
table.insert(rows, check("vehicleIds", entry.id, entry.label, entry.state == "in"))
|
||||
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
|
||||
return rows
|
||||
end
|
||||
|
||||
local function rowsSummary(guide)
|
||||
local rows = {}
|
||||
for _, line in ipairs(ADFlowGuide.summary(guide)) do
|
||||
table.insert(rows, {type = "link", id = "jump", value = line.step, line = line})
|
||||
end
|
||||
return rows
|
||||
end
|
||||
|
||||
local ROWS = {
|
||||
name = rowsName, direction = rowsDirection, buildings = rowsBuildings, goods = rowsGoods, store = rowsStore,
|
||||
rules = rowsRules, wait = rowsWait, tractors = rowsTractors, summary = rowsSummary,
|
||||
}
|
||||
|
||||
function ADFlowGuide.rows(guide)
|
||||
local builder = ROWS[guide.step]
|
||||
return builder ~= nil and builder(guide) or {}
|
||||
end
|
||||
|
||||
-- ---- resumé ----
|
||||
|
||||
-- Korte navne til resuméet (field, ellers navn, ellers rækkens tekst).
|
||||
local function namesFor(ids, entries, field)
|
||||
local byId = {}
|
||||
for _, entry in ipairs(entries or {}) do byId[entry.id or entry.name] = entry[field] or entry.name or entry.text end
|
||||
local names = {}
|
||||
for _, id in ipairs(ids or {}) do table.insert(names, tostring(byId[id] or id)) end
|
||||
return names
|
||||
end
|
||||
|
||||
local SUMMARY = {
|
||||
name = function(guide) return {T(guide.draft.name or "")} end,
|
||||
direction = function(guide) return {L(isOut(guide) and "spu_direction_out" or "spu_direction_in")} end,
|
||||
buildings = function(guide)
|
||||
local names = namesFor(buildingIds(guide.draft), guide.context.buildings, "name")
|
||||
if #names == 0 then return {L("spu_guide_flow_none")} end
|
||||
return {T(ADFlowView.joinCounted(names, " + ", ""))}
|
||||
end,
|
||||
goods = function(guide)
|
||||
local draft = guide.draft
|
||||
if isOut(guide) then
|
||||
local parts = {}
|
||||
local titles = {}
|
||||
for _, product in ipairs(guide.context.products or {}) do titles[product.name] = product.title end
|
||||
for _, product in ipairs(draft.products or {}) do
|
||||
table.insert(parts, {key = "spu_policy_" .. product.policy, prefix = tostring(titles[product.fillType] or product.fillType) .. ": "})
|
||||
end
|
||||
if #parts == 0 then return {L("spu_guide_flow_none")} end
|
||||
return parts
|
||||
end
|
||||
if draft.ingredientMode ~= "manual" then return {L("spu_guide_flow_goodsAuto")} end
|
||||
if #draft.ingredients == 0 then return {L("spu_guide_flow_none")} end
|
||||
if #draft.ingredients > ADFlowGuide.MAX_NAMED_GOODS then return {L("spu_guide_flow_sumGoods", {#draft.ingredients})} end
|
||||
local byName = {}
|
||||
for _, fillType in ipairs(guide.context.fillTypes or {}) do byName[fillType.name] = fillType.title end
|
||||
local names = {}
|
||||
for _, name in ipairs(draft.ingredients) do table.insert(names, tostring(byName[name] or name)) end
|
||||
return {T(table.concat(names, " + "))}
|
||||
end,
|
||||
store = function(guide)
|
||||
local draft = guide.draft
|
||||
if draft.storeAuto or #draft.storeBuildingIds == 0 then return {L("spu_guide_sum_auto")} end
|
||||
if #draft.storeBuildingIds > 2 then return {L("spu_guide_sum_stores", {#draft.storeBuildingIds})} end
|
||||
return {T(table.concat(namesFor(draft.storeBuildingIds, guide.context.storeBuildings, "name"), " + "))}
|
||||
end,
|
||||
rules = function(guide)
|
||||
local draft = guide.draft
|
||||
if isOut(guide) then
|
||||
local parts = {L("spu_guide_flow_sumSellAt", {draft.sellAtPercent}), L("spu_guide_flow_sumStoreAbove", {draft.storeAbovePercent})}
|
||||
if draft.collectRound then table.insert(parts, L("spu_guide_flow_sumRound")) end
|
||||
return parts
|
||||
end
|
||||
local loops = (draft.loops or 0) > 0 and L("spu_guide_flow_sumLoops", {draft.loops}) or L("spu_guide_flow_sumLoopsInf")
|
||||
return {loops, L("spu_guide_flow_sumReturn", {draft.returnBelowPercent})}
|
||||
end,
|
||||
wait = function(guide)
|
||||
local group = guide.draft.waitPoolGroup or ""
|
||||
return {group == "" and L("spu_waitPool_all") or T(group)}
|
||||
end,
|
||||
tractors = function(guide)
|
||||
local ids = guide.draft.vehicleIds
|
||||
if #ids == 0 then return {L("spu_guide_flow_sumNoTractors")} end
|
||||
if #ids > ADFlowGuide.MAX_NAMED_TRACTORS then return {L("spu_guide_flow_sumTractors", {#ids})} end
|
||||
return {T(table.concat(namesFor(ids, guide.context.vehicles, "label"), ", "))}
|
||||
end,
|
||||
}
|
||||
|
||||
-- Resumé-linjer {step, title, parts}: Navn (altid) + de synlige trin.
|
||||
function ADFlowGuide.summary(guide)
|
||||
local lines = {}
|
||||
for _, step in ipairs(ADFlowGuide.ORDER) do
|
||||
local build = SUMMARY[step]
|
||||
if build ~= nil and (step == "name" or ADFlowGuide.isVisible(step, guide)) then
|
||||
table.insert(lines, {step = step, title = L(ADFlowGuide.stepKey(step, guide)), parts = build(guide)})
|
||||
end
|
||||
end
|
||||
return lines
|
||||
end
|
||||
|
||||
-- ---- gem ----
|
||||
|
||||
function ADFlowGuide.result(guide)
|
||||
local draft = guide.draft
|
||||
local storeIds = ADGuide.deepCopy(draft.storeBuildingIds)
|
||||
if ADFlowGuide.isVisible("store", guide) and draft.storeAuto then storeIds = {} end
|
||||
local changes = {
|
||||
kind = draft.kind, sourceBuildingIds = ADGuide.deepCopy(draft.sourceBuildingIds),
|
||||
targetBuildingIds = ADGuide.deepCopy(draft.targetBuildingIds), storeBuildingIds = storeIds,
|
||||
products = ADGuide.deepCopy(draft.products), ingredientMode = draft.ingredientMode,
|
||||
ingredients = ADGuide.deepCopy(draft.ingredients), sellAtPercent = draft.sellAtPercent,
|
||||
storeAbovePercent = draft.storeAbovePercent, collectRound = draft.collectRound, loops = draft.loops,
|
||||
returnBelowPercent = draft.returnBelowPercent, waitPoolGroup = draft.waitPoolGroup or "",
|
||||
}
|
||||
if draft.name ~= nil and draft.name:match("%S") then changes.name = draft.name end
|
||||
return {isNew = draft.isNew == true, runId = draft.id, name = draft.name, kind = draft.kind, changes = changes,
|
||||
vehicleIds = ADGuide.deepCopy(draft.vehicleIds)}
|
||||
end
|
||||
|
||||
-- Traktorer der skal tildeles/fjernes efter gem.
|
||||
function ADFlowGuide.vehicleChanges(oldIds, newIds)
|
||||
local old, new = chosenSet(oldIds), chosenSet(newIds)
|
||||
local added, removed = {}, {}
|
||||
for _, id in ipairs(newIds or {}) do if not old[id] then table.insert(added, id) end end
|
||||
for _, id in ipairs(oldIds or {}) do if not new[id] then table.insert(removed, id) end end
|
||||
return added, removed
|
||||
end
|
||||
@@ -140,9 +140,15 @@ function ADGuide.withContext(guide, context)
|
||||
return clone(guide, {context = context})
|
||||
end
|
||||
|
||||
-- label = {key = "...", args = {...}} (oversættes) eller {text = "..."} (færdig tekst).
|
||||
-- label = {key = "...", args = {...}} (oversættes) eller {text = "..."} (færdig tekst); valgfri prefix
|
||||
-- (færdig tekst foran, fx "Mælk: " foran den oversatte politik).
|
||||
function ADGuide.labelText(label, getText)
|
||||
if type(label) ~= "table" then return "" end
|
||||
if label.prefix ~= nil then
|
||||
local rest = {}
|
||||
for key, value in pairs(label) do if key ~= "prefix" then rest[key] = value end end
|
||||
return tostring(label.prefix) .. ADGuide.labelText(rest, getText)
|
||||
end
|
||||
if label.text ~= nil then return tostring(label.text) end
|
||||
local template = getText(label.key)
|
||||
if label.args == nil or #label.args == 0 then return tostring(template) end
|
||||
|
||||
@@ -27,6 +27,7 @@ if ADSmartPickup.dir ~= nil and source ~= nil then
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupFieldTab.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupGuide.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupFieldGuide.lua")
|
||||
source(ADSmartPickup.dir .. "gui/SmartPickupFlowGuide.lua")
|
||||
end
|
||||
|
||||
-- Markøren er dér hvor trækkerens næse stopper; læssetriggeren ligger et
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
-- Smart Pickup — fanen Flows: tavle + resumé, og guiden "Opsæt flow"
|
||||
-- Tavlen øverst (én række pr. flow), det valgte flows resumé (klik på en linje = ret ét trin; Navn = omdøb)
|
||||
-- og status. [Opsæt flow] / [Nyt flow] åbner guiden på den fælles trin-skærm (gui/SmartPickupGuide.lua).
|
||||
-- Henter det spil-afhængige som `context` til ADFlowGuide og gemmer via ADRunsController.
|
||||
-- Funktionerne lægges på SmartPickupFrame (indlæses efter SmartPickupFrame.lua).
|
||||
|
||||
function SmartPickupFrame:initFlowButtons(i18n)
|
||||
self.flowSetupButtonInfo = {inputAction = InputAction.MENU_EXTRA_1, text = i18n:getText("spu_guide_flow_open"), callback = function() self:onClickFlowSetup() end}
|
||||
self.flowNewButtonInfo = {inputAction = InputAction.MENU_EXTRA_2, text = i18n:getText("spu_button_new"), callback = function() self:onClickFlowNew() end}
|
||||
-- Flows-fanen: [Start/Stop] [Opsæt flow] [Nyt flow] [Slet]; omdøb ligger på resuméets Navn-linje
|
||||
self.flowButtons = {self.backButtonInfo, self.startButtonInfo, self.flowSetupButtonInfo, self.flowNewButtonInfo, self.deleteButtonInfo}
|
||||
end
|
||||
|
||||
-- ---- traktor-tekst (også til guidens traktorliste) ----
|
||||
|
||||
-- "Fastrac 2135 4WS (#1) — 1.000.000 l — kan bære: Halm, TMR — OK" / "… — X ingen vogn".
|
||||
function SmartPickupFrame:describeVehicle(adEnv, run, vehicle, isInRun)
|
||||
local label = ADRunsController.getVehicleLabel(adEnv, vehicle)
|
||||
local validation = ADRunsController.validateVehicle(adEnv, run, vehicle)
|
||||
local parts = {label}
|
||||
if validation.isAutoload and validation.capacity == nil then
|
||||
table.insert(parts, self.i18n:getText("spu_capacity_pallets"))
|
||||
elseif validation.capacity ~= nil then
|
||||
table.insert(parts, string.format(self.i18n:getText("spu_capacity"), g_i18n:formatNumber(validation.capacity, 0)))
|
||||
local carriable = self:describeCarriable(adEnv, run, vehicle, validation.carriable)
|
||||
if carriable ~= nil then
|
||||
table.insert(parts, carriable)
|
||||
end
|
||||
end
|
||||
if validation.ok then
|
||||
table.insert(parts, "OK")
|
||||
else
|
||||
local reason = self.i18n:getText("spu_reason_" .. tostring(validation.reason))
|
||||
if validation.reason == "noMarker" and validation.missingBuilding ~= nil then
|
||||
reason = string.format(reason, tostring(validation.missingBuilding))
|
||||
end
|
||||
table.insert(parts, "X " .. reason)
|
||||
end
|
||||
return table.concat(parts, " — ")
|
||||
end
|
||||
|
||||
-- Hvilke af run'ets varer vognen kan bære (titler); nil når ingen.
|
||||
function SmartPickupFrame:describeCarriable(adEnv, run, vehicle, carriable)
|
||||
local canCarry = {}
|
||||
for _, fillType in ipairs(carriable or {}) do
|
||||
canCarry[fillType] = true
|
||||
end
|
||||
local titles = {}
|
||||
for _, fillType in ipairs(ADRunsController.getRunIngredients(adEnv, run, vehicle)) do
|
||||
if canCarry[fillType] then
|
||||
local title = g_fillTypeManager.getFillTypeTitleByIndex ~= nil and g_fillTypeManager:getFillTypeTitleByIndex(fillType) or nil
|
||||
table.insert(titles, tostring(title or g_fillTypeManager:getFillTypeNameByIndex(fillType)))
|
||||
end
|
||||
end
|
||||
if #titles == 0 then
|
||||
return nil
|
||||
end
|
||||
return string.format(self.i18n:getText("spu_canCarry"), table.concat(titles, ", "))
|
||||
end
|
||||
|
||||
-- ---- context til ADFlowGuide ----
|
||||
|
||||
local function trim(text)
|
||||
return (string.gsub(tostring(text or ""), "^%s+", ""))
|
||||
end
|
||||
|
||||
local function idSet(list)
|
||||
local set = {}
|
||||
for _, id in ipairs(list or {}) do set[id] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
function SmartPickupFrame:flowBuildingContext(adEnv, draft, farmId)
|
||||
local isOut = draft.kind == "outbound"
|
||||
local role = isOut and "load" or "unload"
|
||||
local chosen = idSet(isOut and draft.sourceBuildingIds or draft.targetBuildingIds)
|
||||
local buildings, found = {}, {}
|
||||
for _, building in ipairs(ADBuildings.list(adEnv, farmId)) do
|
||||
local fits = (isOut and building.canBeSource) or (not isOut and building.canBeTarget)
|
||||
if fits or chosen[building.id] then
|
||||
local markers = ADBuildings.getMarkers ~= nil and ADBuildings.getMarkers(building, role) or {}
|
||||
found[building.id] = true
|
||||
table.insert(buildings, {id = building.id, name = tostring(building.name), label = markers[1] ~= nil and tostring(markers[1].name) or nil,
|
||||
hasMarker = markers[1] ~= nil, text = trim(self:describeBuilding(building, role))})
|
||||
end
|
||||
end
|
||||
-- valgte bygninger der ikke længere findes (solgt): kan fravælges
|
||||
for id in pairs(chosen) do
|
||||
if not found[id] then
|
||||
local gone = self.i18n:getText("spu_buildingGone")
|
||||
table.insert(buildings, {id = id, name = gone, hasMarker = false, text = gone})
|
||||
end
|
||||
end
|
||||
return buildings
|
||||
end
|
||||
|
||||
function SmartPickupFrame:flowStoreContext(adEnv, preview, farmId)
|
||||
local goods = ADRunsController.getStoreGoods(adEnv, preview)
|
||||
local chosen = idSet(preview.storeBuildingIds)
|
||||
local result = {}
|
||||
for _, building in ipairs(ADBuildings.list(adEnv, farmId)) do
|
||||
local isStoreKind = building.kind == "silo" or building.kind == "factory" or building.kind == "objectStorage"
|
||||
if isStoreKind and (chosen[building.id] or ADRunsController.canStoreAt(adEnv, building, goods)) then
|
||||
table.insert(result, {id = building.id, name = tostring(building.name), text = trim(self:describeBuilding(building, "unload"))})
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function SmartPickupFrame:flowVehicleContext(adEnv, preview)
|
||||
local result = {}
|
||||
for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do
|
||||
local ok, entry = pcall(function()
|
||||
local text = self:describeVehicle(adEnv, preview, vehicle, false)
|
||||
local validation = ADRunsController.validateVehicle(adEnv, preview, vehicle)
|
||||
local other = ADRunsController.getRunForVehicle(vehicle)
|
||||
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
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
-- draft: kladden (eller selve run'et — samme feltnavne).
|
||||
function SmartPickupFrame:flowGuideContext(adEnv, draft)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local preview = ADFlowGuide.previewRun(draft, function(buildingId, role)
|
||||
local building = ADBuildings.find(adEnv, farmId, buildingId)
|
||||
local ids = {}
|
||||
for _, marker in ipairs(building ~= nil and ADBuildings.getMarkers ~= nil and ADBuildings.getMarkers(building, role) or {}) do
|
||||
table.insert(ids, marker.id)
|
||||
end
|
||||
return ids
|
||||
end)
|
||||
local context = {buildings = self:flowBuildingContext(adEnv, draft, farmId), fillTypes = {}, products = {}, storeBuildings = {},
|
||||
waitPools = ADRunsController.getWaitPools(adEnv), vehicles = self:flowVehicleContext(adEnv, preview)}
|
||||
if draft.kind == "outbound" then
|
||||
for _, product in ipairs(ADRunsController.getRunProducts(adEnv, preview)) do
|
||||
local title = tostring(product.title)
|
||||
table.insert(context.products, {name = product.name, title = title,
|
||||
text = string.format("%s — %s l", title, SmartPickupFrame.formatCompact(product.available or 0))})
|
||||
end
|
||||
context.storeBuildings = self:flowStoreContext(adEnv, preview, farmId)
|
||||
else
|
||||
for _, fillType in ipairs(ADRunsController.getTargetAcceptedFillTypes(adEnv, preview)) do
|
||||
table.insert(context.fillTypes, {name = fillType.name, title = tostring(fillType.title)})
|
||||
end
|
||||
end
|
||||
return context
|
||||
end
|
||||
|
||||
-- ---- fanen: tavle + resumé ----
|
||||
|
||||
function SmartPickupFrame:fillFlowTabRows(adEnv)
|
||||
if self:hasGuideOn(SmartPickupFrame.TAB_FLOWS) and self:fillGuideRows(adEnv) then return end
|
||||
self:fillOverviewRows(adEnv)
|
||||
local run = self:getRun()
|
||||
if run ~= nil then self:fillFlowSummary(adEnv, run) end
|
||||
end
|
||||
|
||||
function SmartPickupFrame:fillFlowSummary(adEnv, run)
|
||||
local i18n = self.i18n
|
||||
self:addTextRow(string.format(i18n:getText("spu_guide_flow_section"), tostring(run.name)))
|
||||
self:addTextRow(" " .. i18n:getText("spu_guide_sum_hint"))
|
||||
local guide = ADFlowGuide.open(run, self:flowGuideContext(adEnv, run))
|
||||
local getText = function(key) return i18n:getText(key) end
|
||||
local runId = run.id
|
||||
for _, line in ipairs(ADFlowGuide.summary(guide)) do
|
||||
local step = line.step
|
||||
self:addLinkRow(" " .. ADGuide.lineText(line, getText) .. i18n:getText("spu_guide_editSuffix"), function(frame)
|
||||
if step == "name" then frame:onClickRename() else frame:openFlowStep(runId, step) end
|
||||
end)
|
||||
end
|
||||
local cells = self:flowCells(adEnv, run)
|
||||
self:addTextRow(" " .. string.format(i18n:getText("spu_field_statusFull"), tostring(cells[6])))
|
||||
end
|
||||
|
||||
-- Hvert sekund: tavlens celler, statuslinje og knapper.
|
||||
function SmartPickupFrame:refreshFlowTab(adEnv)
|
||||
local run = self:getRun()
|
||||
local isRunning = false
|
||||
if self:hasGuideOn(SmartPickupFrame.TAB_FLOWS) then
|
||||
self:setStatusText(self.statusOverride or "")
|
||||
else
|
||||
self:refreshOverview(adEnv)
|
||||
if run ~= nil then
|
||||
local status = ADRunsController.getRunStatus(adEnv, run)
|
||||
isRunning = status.isRunning == true
|
||||
local text = status.running > 0 and string.format(self.i18n:getText("spu_status_running"), status.running, status.total)
|
||||
or string.format(self.i18n:getText("spu_status_stopped"), status.total)
|
||||
self:setStatusText(self.statusOverride or text)
|
||||
else
|
||||
-- tavlen siger allerede "Ingen flows"
|
||||
self:setStatusText(self.statusOverride or "")
|
||||
end
|
||||
end
|
||||
self.startButtonInfo.text = self.i18n:getText(isRunning and "spu_button_stop" or "spu_button_start")
|
||||
self.startButtonInfo.disabled = run == nil
|
||||
self.flowSetupButtonInfo.disabled = run == nil
|
||||
self.deleteButtonInfo.disabled = run == nil
|
||||
end
|
||||
|
||||
-- ---- hooks til den fælles guide-skærm ----
|
||||
|
||||
SmartPickupFrame.GUIDE_HOOKS = SmartPickupFrame.GUIDE_HOOKS or {}
|
||||
SmartPickupFrame.GUIDE_HOOKS.flow = {
|
||||
model = ADFlowGuide,
|
||||
tab = SmartPickupFrame.TAB_FLOWS,
|
||||
heading = function(frame, guide)
|
||||
return string.format(frame.i18n:getText("spu_guide_flow_title"), tostring(guide.draft.name))
|
||||
end,
|
||||
context = function(frame, adEnv, guide)
|
||||
-- flowet er slettet mens guiden var åben
|
||||
if not guide.draft.isNew and ADRuns.getRun(ADRunsController.store, guide.draft.id) == nil then return nil end
|
||||
return frame:flowGuideContext(adEnv, guide.draft)
|
||||
end,
|
||||
choose = function(frame, id)
|
||||
if id ~= "rename" then return false end
|
||||
TextInputDialog.show(SmartPickupFrame.onGuideNameResult, frame, frame.guide.draft.name, frame.i18n:getText("spu_renameTitle"), nil, 30, g_i18n:getText("button_ok"))
|
||||
return true
|
||||
end,
|
||||
startKey = function() return "spu_guide_flow_start" end,
|
||||
save = function(frame, guide, start) frame:saveFlowGuide(guide, start) end,
|
||||
}
|
||||
|
||||
function SmartPickupFrame:onGuideNameResult(value, clickOk)
|
||||
self:safe(function(frame)
|
||||
if not clickOk or frame.guide == nil or frame.guideKind ~= "flow" then return end
|
||||
frame.guide = ADFlowGuide.choose(frame.guide, "name", value)
|
||||
frame:requestRebuild()
|
||||
end)
|
||||
end
|
||||
|
||||
-- Gem: nyt flow oprettes først nu; felterne via updateRun; traktorer tildeles/fjernes; markører findes.
|
||||
-- start = true: flowet startes bagefter ([Start flow]).
|
||||
function SmartPickupFrame:saveFlowGuide(guide, start)
|
||||
local adEnv = self.getAdEnv()
|
||||
local result = ADFlowGuide.result(guide)
|
||||
local runId = result.runId
|
||||
local oldIds = {}
|
||||
if result.isNew then
|
||||
runId = ADRunsController.createRun(result.name, result.kind).id
|
||||
else
|
||||
local existing = ADRuns.getRun(ADRunsController.store, runId)
|
||||
if existing == nil then return end
|
||||
oldIds = existing.vehicleIds
|
||||
end
|
||||
ADRunsController.updateRun(runId, result.changes)
|
||||
local added, removed = ADFlowGuide.vehicleChanges(oldIds, result.vehicleIds)
|
||||
for _, id in ipairs(removed) do
|
||||
local vehicle = adEnv ~= nil and ADRunsController.findVehicleById(adEnv, id) or nil
|
||||
if vehicle ~= nil then
|
||||
ADRunsController.unassignVehicle(vehicle)
|
||||
else
|
||||
ADRunsController.store = ADRuns.unassignVehicle(ADRunsController.store, id)
|
||||
end
|
||||
end
|
||||
for _, id in ipairs(added) do
|
||||
local vehicle = adEnv ~= nil and ADRunsController.findVehicleById(adEnv, id) or nil
|
||||
if vehicle ~= nil then ADRunsController.assignVehicle(runId, vehicle) end
|
||||
end
|
||||
ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, runId))
|
||||
self.selectedRunId = runId
|
||||
local saved = string.format(self.i18n:getText("spu_guide_flow_saved"), tostring(result.name))
|
||||
if start and adEnv ~= nil and not ADRunsController.getRunStatus(adEnv, ADRuns.getRun(ADRunsController.store, runId)).isRunning then
|
||||
local started, skipped, reasons = self:summarizeStartResults(ADRunsController.startRun(adEnv, runId))
|
||||
self:showOverride(saved .. " — " .. string.format(self.i18n:getText("spu_status_started"), started, skipped), reasons)
|
||||
else
|
||||
self:showOverride(saved)
|
||||
end
|
||||
ADRunsController.save()
|
||||
end
|
||||
|
||||
-- ---- knapper og [Ret] ----
|
||||
|
||||
function SmartPickupFrame:onClickFlowSetup()
|
||||
self:safe(function(frame)
|
||||
local adEnv, run = frame.getAdEnv(), frame:getRun()
|
||||
if adEnv == nil or run == nil then return end
|
||||
frame:openGuide("flow", ADFlowGuide.open(run, frame:flowGuideContext(adEnv, run)))
|
||||
end)
|
||||
end
|
||||
|
||||
-- [Nyt flow] (også fra fanen Oversigt): guiden på Flows-fanen; intet oprettes før [Gem].
|
||||
function SmartPickupFrame:onClickFlowNew()
|
||||
self:safe(function(frame)
|
||||
local adEnv = frame.getAdEnv()
|
||||
if adEnv == nil then return end
|
||||
local name = string.format(frame.i18n:getText("spu_newRunName"), #ADRunsController.store.runs + 1)
|
||||
local guide = ADFlowGuide.openNew(name, {})
|
||||
guide = ADGuide.withContext(guide, frame:flowGuideContext(adEnv, guide.draft))
|
||||
if frame.currentTab ~= SmartPickupFrame.TAB_FLOWS then frame:switchTab(SmartPickupFrame.TAB_FLOWS) end
|
||||
frame:openGuide("flow", guide)
|
||||
end)
|
||||
end
|
||||
|
||||
function SmartPickupFrame:openFlowStep(runId, step)
|
||||
local adEnv = self.getAdEnv()
|
||||
local run = ADRuns.getRun(ADRunsController.store, runId)
|
||||
if adEnv == nil or run == nil then return end
|
||||
self:openGuide("flow", ADFlowGuide.open(run, self:flowGuideContext(adEnv, run), {step = step, single = true, returnTo = "close"}))
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Smart Pickup — fanen Flows
|
||||
-- Tavle øverst: én tekstrække pr. flow (Vare · Fra → Til · Regel · Traktorer · Status), det valgte
|
||||
-- markeret med ">". Under tavlen: detail-blok for det valgte flow — Retning, Fra/Til som BYGNINGER
|
||||
-- (markøren findes automatisk), Varer, Regler, Vent ved, Traktorer, Status — og Wait-puljerne.
|
||||
-- Tavlen (én række pr. flow, det valgte markeret med ">") bruges af fanerne Oversigt og Flows; Flows-fanens
|
||||
-- resumé og guiden "Opsæt flow" ligger i gui/SmartPickupFlowGuide.lua. Her også bygnings-teksten og de
|
||||
-- gamle klik-callbacks for retning/bygninger.
|
||||
-- Funktionerne lægges på SmartPickupFrame (indlæses efter SmartPickupFrame.lua).
|
||||
|
||||
-- ---- tavlen ----
|
||||
@@ -137,86 +137,6 @@ function SmartPickupFrame:describeBuilding(building, role)
|
||||
return string.format(" %s — %s", building.name, table.concat(parts, " · "))
|
||||
end
|
||||
|
||||
-- Afkrydsning pr. bygning: kilder (udkørsel, role "load") eller mål (forsyning, role "unload").
|
||||
function SmartPickupFrame:fillBuildingRows(adEnv, run, role)
|
||||
if ADBuildings == nil then
|
||||
self:addTextRow(self.i18n:getText("spu_status_noAd"))
|
||||
return
|
||||
end
|
||||
local chosen = {}
|
||||
local ids = role == "load" and run.sourceBuildingIds or role == "store" and run.storeBuildingIds or run.targetBuildingIds
|
||||
local rowKind = role == "load" and "sourceBuilding" or role == "store" and "storeBuilding" or "targetBuilding"
|
||||
for _, id in ipairs(ids or {}) do chosen[id] = true end
|
||||
local count = 0
|
||||
-- kandidater i fast rækkefølge (navn, markør); uden markør kun med "Vis alle bygninger"
|
||||
local candidates = {}
|
||||
-- "Lager til": kun bygninger der kan tage flowets lagervarer (æg-paller -> palleskure der tager æg)
|
||||
local storeGoods = role == "store" and ADRunsController.getStoreGoods(adEnv, run) or nil
|
||||
for _, building in ipairs(ADBuildings.list(adEnv, g_currentMission:getFarmId())) do
|
||||
local isStoreKind = building.kind == "silo" or building.kind == "factory" or building.kind == "objectStorage"
|
||||
local fits = (role == "load" and building.canBeSource) or (role == "unload" and building.canBeTarget)
|
||||
or (role == "store" and isStoreKind and (chosen[building.id] or ADRunsController.canStoreAt(adEnv, building, storeGoods)))
|
||||
if fits then
|
||||
local markers = ADBuildings.getMarkers ~= nil and ADBuildings.getMarkers(building, role == "store" and "unload" or role) or {}
|
||||
table.insert(candidates, {id = building.id, name = building.name, label = markers[1] ~= nil and tostring(markers[1].name) or nil, hasMarker = markers[1] ~= nil, building = building})
|
||||
end
|
||||
end
|
||||
local shown = ADFlowView.buildingRows(candidates, chosen, self.showAllBuildings == true)
|
||||
local hiddenBuildings = ADFlowView.hiddenCount(candidates, shown)
|
||||
if hiddenBuildings > 0 or self.showAllBuildings then
|
||||
self:addToggleRow("showAllBuildings", string.format(self.i18n:getText("spu_showAllBuildings"), hiddenBuildings), {self.i18n:getText("ui_no"), self.i18n:getText("ui_yes")}, self.showAllBuildings == true)
|
||||
end
|
||||
for _, entry in ipairs(shown) do
|
||||
local building = entry.building
|
||||
count = count + 1
|
||||
local row = self:addRow(self.ingredientPrefab, {kind = rowKind, buildingId = building.id})
|
||||
row:getDescendantByName("title"):setText(self:describeBuilding(building, role == "store" and "unload" or role))
|
||||
row:getDescendantByName("option"):setState(chosen[building.id] and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
|
||||
end
|
||||
-- valgte bygninger der ikke længere findes (solgt)
|
||||
for _, id in ipairs(ids or {}) do
|
||||
if ADBuildings.find(adEnv, g_currentMission:getFarmId(), id) == nil then
|
||||
local row = self:addRow(self.ingredientPrefab, {kind = rowKind, buildingId = id})
|
||||
row:getDescendantByName("title"):setText(" " .. self.i18n:getText("spu_buildingGone"))
|
||||
row:getDescendantByName("option"):setState(SmartPickupFrame.STATE_ON, false)
|
||||
end
|
||||
end
|
||||
if count == 0 then
|
||||
self:addTextRow(self.i18n:getText("spu_noBuildings"))
|
||||
end
|
||||
end
|
||||
|
||||
function SmartPickupFrame:rebuildFlowDetail(adEnv, run)
|
||||
ADRunsController.resolveMarkers(adEnv, run)
|
||||
run = self:getRun()
|
||||
local isOut = run.kind == "outbound"
|
||||
self:addTextRow(string.format(self.i18n:getText("spu_section_flow"), run.name))
|
||||
self.directionRowOption = self:addToggleRow("direction", self.i18n:getText("spu_direction"), {self.i18n:getText("spu_direction_in"), self.i18n:getText("spu_direction_out")}, isOut)
|
||||
if isOut then
|
||||
self:addTextRow(self.i18n:getText("spu_section_from"))
|
||||
self:fillBuildingRows(adEnv, run, "load")
|
||||
self:addTextRow(self.i18n:getText("spu_section_products"))
|
||||
self:fillProductRows(adEnv, run)
|
||||
self:addTextRow(self.i18n:getText("spu_section_rules"))
|
||||
self.sellAtOption:setState(SmartPickupFrame.getStepIndex(self.sellAtSteps, run.sellAtPercent, ADRuns.DEFAULT_SELL_AT_PERCENT), false)
|
||||
self.storeAboveOption:setState(SmartPickupFrame.getStepIndex(self.storeAboveSteps, run.storeAbovePercent, ADRuns.DEFAULT_STORE_ABOVE_PERCENT), false)
|
||||
self.collectRoundRowOption = self:addToggleRow("collectRound", self.i18n:getText("spu_collectRound"), {self.i18n:getText("ui_no"), self.i18n:getText("ui_yes")}, run.collectRound == true)
|
||||
self:addTextRow(self.i18n:getText("spu_section_store"))
|
||||
self:fillBuildingRows(adEnv, run, "store")
|
||||
self:fillOutboundStatusRows(adEnv, run)
|
||||
else
|
||||
self:addTextRow(self.i18n:getText("spu_section_to"))
|
||||
self:fillBuildingRows(adEnv, run, "unload")
|
||||
self:addTextRow(self.i18n:getText("spu_section_targets"))
|
||||
self.ingredientModeRowOption = self:addToggleRow("ingredientMode", self.i18n:getText("spu_ingredientMode"), {self.i18n:getText("spu_mode_auto"), self.i18n:getText("spu_mode_manual")}, run.ingredientMode == "manual")
|
||||
self:fillIngredientRows(adEnv, run)
|
||||
self:fillNeedsRows(adEnv, run)
|
||||
self:addTextRow(self.i18n:getText("spu_section_rules"))
|
||||
self.loopsOption:setState(run.loops + 1, false)
|
||||
self.returnBelowOption:setState(self:getReturnBelowIndex(run), false)
|
||||
end
|
||||
end
|
||||
|
||||
-- ---- callbacks ----
|
||||
|
||||
function SmartPickupFrame:onClickDirection(state)
|
||||
|
||||
@@ -55,6 +55,8 @@ function SmartPickupFrame.new(i18n, getAdEnv)
|
||||
-- Marker: [Start nu/Stop], [Opsæt mark], [Markflåde] (gui/SmartPickupFieldGuide.lua); guidens knapper
|
||||
self:initFieldButtons(i18n)
|
||||
self:initGuideButtons(i18n)
|
||||
-- Flows: [Start/Stop] [Opsæt flow] [Nyt flow] [Slet] (gui/SmartPickupFlowGuide.lua)
|
||||
self:initFlowButtons(i18n)
|
||||
-- Egen reference til listen: fallback'en i refreshButtons skal kunne sende den igen.
|
||||
self.menuButtonInfo = self.overviewButtons
|
||||
self:setMenuButtonInfo(self.menuButtonInfo)
|
||||
@@ -267,7 +269,8 @@ end
|
||||
-- De faste rækker: Flow-vælger + Wait-pulje for alle flows; Ture/kør hjem for forsyning; Sælg fra/
|
||||
-- Kør til lager for udkørsel. Fanen Lagre viser ingen.
|
||||
function SmartPickupFrame:setStaticRowsVisible(tab, run)
|
||||
local isFlows = tab == SmartPickupFrame.TAB_FLOWS
|
||||
-- Flows-fanen bruger tavle + resumé + guide (v1.32); de faste XML-rækker vises ikke længere
|
||||
local isFlows = false
|
||||
local hasRun = isFlows and run ~= nil
|
||||
local isSupply, isOutbound = hasRun and run.kind ~= "outbound", hasRun and run.kind == "outbound"
|
||||
local visibility = {
|
||||
@@ -419,19 +422,8 @@ function SmartPickupFrame:rebuild()
|
||||
self:restoreFocusIfLost()
|
||||
return
|
||||
end
|
||||
self:fillRunOption(adEnv)
|
||||
local hasRun = run ~= nil and adEnv ~= nil
|
||||
for _, element in ipairs({self.waitPoolOption, self.loopsOption, self.returnBelowOption, self.sellAtOption, self.storeAboveOption}) do
|
||||
if element ~= nil then
|
||||
element:setDisabled(not hasRun)
|
||||
end
|
||||
end
|
||||
if hasRun then
|
||||
self:fillWaitPoolOption(adEnv, run)
|
||||
self:rebuildFlowDetail(adEnv, run)
|
||||
self:addTextRow(self.i18n:getText("spu_section_vehicles"))
|
||||
self:fillVehicleRows(adEnv, run)
|
||||
self:addTextRow(self.i18n:getText("spu_section_status"))
|
||||
if adEnv ~= nil then
|
||||
self:fillFlowTabRows(adEnv)
|
||||
end
|
||||
self.statusRow = self:addTextRow("")
|
||||
self:colorRows()
|
||||
@@ -440,25 +432,6 @@ function SmartPickupFrame:rebuild()
|
||||
self:restoreFocusIfLost()
|
||||
end
|
||||
|
||||
function SmartPickupFrame:fillRunOption(adEnv)
|
||||
local texts, index = {}, 1
|
||||
self.runIds = {}
|
||||
for position, run in ipairs(self:getRunsForTab()) do
|
||||
local status = adEnv ~= nil and ADRunsController.getRunStatus(adEnv, run) or {running = 0, total = #run.vehicleIds}
|
||||
table.insert(texts, string.format("%s (%d/%d)", run.name, status.running, status.total))
|
||||
table.insert(self.runIds, run.id)
|
||||
if run.id == self.selectedRunId then
|
||||
index = position
|
||||
end
|
||||
end
|
||||
if #texts == 0 then
|
||||
texts = {self.i18n:getText("spu_noRuns")}
|
||||
end
|
||||
self.runOption:setTexts(texts)
|
||||
self.runOption:setState(index, false)
|
||||
self.runOption:setDisabled(#self.runIds == 0)
|
||||
end
|
||||
|
||||
-- Overblik: "Cow 1 food: TMR 18.0k/27.8k · Silage 3.0k/…" (mest trængende først)
|
||||
function SmartPickupFrame:describeTargetLevels(target)
|
||||
if #target.levels == 0 then
|
||||
@@ -467,114 +440,6 @@ function SmartPickupFrame:describeTargetLevels(target)
|
||||
return string.format("%s: %s", target.name, self:formatLevels(target.levels))
|
||||
end
|
||||
|
||||
function SmartPickupFrame:fillWaitPoolOption(adEnv, run)
|
||||
local texts, index = {self.i18n:getText("spu_waitPool_all")}, 1
|
||||
self.poolGroups = {""}
|
||||
for _, pool in ipairs(ADRunsController.getWaitPools(adEnv)) do
|
||||
table.insert(texts, string.format("%s (%d)", pool.group, pool.count))
|
||||
table.insert(self.poolGroups, pool.group)
|
||||
if pool.group == run.waitPoolGroup then
|
||||
index = #texts
|
||||
end
|
||||
end
|
||||
self.waitPoolOption:setTexts(texts)
|
||||
self.waitPoolOption:setState(index, false)
|
||||
end
|
||||
|
||||
-- Traktorer: som standard flowets egne og de ledige der kan bruges; "Vis alle" tilføjer traktorer i andre
|
||||
-- flows og låste (vognen passer ikke) — de er tit mange og gør listen uoverskuelig.
|
||||
function SmartPickupFrame:fillVehicleRows(adEnv, run)
|
||||
local inRun = {}
|
||||
for _, id in ipairs(run.vehicleIds) do
|
||||
inRun[id] = true
|
||||
end
|
||||
local entries = {}
|
||||
for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do
|
||||
local id = ADRunsController.getVehicleId(vehicle)
|
||||
local otherRun = ADRunsController.getRunForVehicle(vehicle)
|
||||
local state = "free"
|
||||
if inRun[id] then
|
||||
state = "in"
|
||||
elseif otherRun ~= nil and otherRun.id ~= run.id then
|
||||
state = "other"
|
||||
elseif SmartPickupFrame.VEHICLE_BLOCKING_REASONS[ADRunsController.validateVehicle(adEnv, run, vehicle).reason] then
|
||||
state = "blocked"
|
||||
end
|
||||
table.insert(entries, {id = id, label = ADRunsController.getVehicleLabel(adEnv, vehicle), state = state, vehicle = vehicle, otherRun = otherRun})
|
||||
end
|
||||
local rows = ADFlowView.vehicleRows(entries, self.showAllVehicles == true)
|
||||
local hidden = ADFlowView.hiddenCount(entries, rows)
|
||||
if hidden > 0 or self.showAllVehicles then
|
||||
self.showAllVehiclesOption = self:addToggleRow("showAllVehicles", string.format(self.i18n:getText("spu_showAllVehicles"), hidden), {self.i18n:getText("ui_no"), self.i18n:getText("ui_yes")}, self.showAllVehicles == true)
|
||||
end
|
||||
for _, entry in ipairs(rows) do
|
||||
local vehicle = entry.vehicle
|
||||
local row = self:addRow(self.vehiclePrefab, {kind = "vehicle", vehicle = vehicle, row = nil})
|
||||
local option, title = row:getDescendantByName("option"), row:getDescendantByName("title")
|
||||
self.rowData[option].row = row
|
||||
option:setState(entry.state == "in" and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
|
||||
if entry.state == "other" then
|
||||
-- én traktor = ét flow; rækken viser hvor den er
|
||||
option:setDisabled(true)
|
||||
self.rowData[option].locked = true
|
||||
title:setText(string.format("%s — %s", entry.label, string.format(self.i18n:getText("spu_inRun"), tostring(entry.otherRun.name))))
|
||||
else
|
||||
title:setText(self:describeVehicle(adEnv, run, vehicle, entry.state == "in"))
|
||||
if entry.state == "blocked" then
|
||||
option:setDisabled(true)
|
||||
self.rowData[option].locked = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- "Fastrac 2135 4WS (#1) — 1.000.000 l — ✔" / "… — ✖ ingen vogn"; reservationsnote fra Start bevares.
|
||||
-- "Fastrac 2135 4WS (#1) — 1.000.000 l — kan bære: Halm, TMR — ✔" / "… — ✖ ingen vogn".
|
||||
-- Vises for ALLE traktorer, så man kan se om vognen passer, før man siger Ja.
|
||||
function SmartPickupFrame:describeVehicle(adEnv, run, vehicle, isInRun)
|
||||
local label = ADRunsController.getVehicleLabel(adEnv, vehicle)
|
||||
local validation = ADRunsController.validateVehicle(adEnv, run, vehicle)
|
||||
local parts = {label}
|
||||
if validation.isAutoload and validation.capacity == nil then
|
||||
table.insert(parts, self.i18n:getText("spu_capacity_pallets"))
|
||||
elseif validation.capacity ~= nil then
|
||||
table.insert(parts, string.format(self.i18n:getText("spu_capacity"), g_i18n:formatNumber(validation.capacity, 0)))
|
||||
local carriable = self:describeCarriable(adEnv, run, vehicle, validation.carriable)
|
||||
if carriable ~= nil then
|
||||
table.insert(parts, carriable)
|
||||
end
|
||||
end
|
||||
if validation.ok then
|
||||
table.insert(parts, "OK")
|
||||
else
|
||||
local reason = self.i18n:getText("spu_reason_" .. tostring(validation.reason))
|
||||
if validation.reason == "noMarker" and validation.missingBuilding ~= nil then
|
||||
reason = string.format(reason, tostring(validation.missingBuilding))
|
||||
end
|
||||
table.insert(parts, "X " .. reason)
|
||||
end
|
||||
return table.concat(parts, " — ")
|
||||
end
|
||||
|
||||
-- Hvilke af run'ets varer vognen kan bære (titler); nil når ingen.
|
||||
function SmartPickupFrame:describeCarriable(adEnv, run, vehicle, carriable)
|
||||
local canCarry = {}
|
||||
for _, fillType in ipairs(carriable or {}) do
|
||||
canCarry[fillType] = true
|
||||
end
|
||||
local titles = {}
|
||||
for _, fillType in ipairs(ADRunsController.getRunIngredients(adEnv, run, vehicle)) do
|
||||
if canCarry[fillType] then
|
||||
local title = g_fillTypeManager.getFillTypeTitleByIndex ~= nil and g_fillTypeManager:getFillTypeTitleByIndex(fillType) or nil
|
||||
table.insert(titles, tostring(title or g_fillTypeManager:getFillTypeNameByIndex(fillType)))
|
||||
end
|
||||
end
|
||||
if #titles == 0 then
|
||||
return nil
|
||||
end
|
||||
return string.format(self.i18n:getText("spu_canCarry"), table.concat(titles, ", "))
|
||||
end
|
||||
|
||||
-- Felterne følger modellen: når et klik ikke er nået ind i run'et, springer feltet tilbage,
|
||||
-- og loggen ("run '…': waitPoolGroup=…") viser om klikket blev registreret.
|
||||
function SmartPickupFrame:syncOptionsFromModel(adEnv, run)
|
||||
@@ -706,6 +571,13 @@ function SmartPickupFrame:refreshLive()
|
||||
self:refreshButtons()
|
||||
return
|
||||
end
|
||||
if self.currentTab == SmartPickupFrame.TAB_FLOWS then
|
||||
self:refreshFlowTab(adEnv)
|
||||
self.statusOverrideTicks = (self.statusOverrideTicks or 0) - 1
|
||||
if self.statusOverrideTicks <= 0 then self.statusOverride = nil end
|
||||
self:refreshButtons()
|
||||
return
|
||||
end
|
||||
self:refreshStorageRows(adEnv)
|
||||
local isRunning = false
|
||||
if isOverview then
|
||||
@@ -919,26 +791,9 @@ function SmartPickupFrame:openFlow(runId)
|
||||
self:switchTab(SmartPickupFrame.TAB_FLOWS)
|
||||
end
|
||||
|
||||
-- Nyt run: navnet vælges FØR run'et oprettes (annulleres dialogen, oprettes intet).
|
||||
-- Forslaget tæller efter antal runs, ikke efter løbenummeret, så "Run 2" kan genbruges.
|
||||
-- Nyt flow: guiden "Opsæt flow" (gui/SmartPickupFlowGuide.lua) — intet oprettes før [Gem].
|
||||
function SmartPickupFrame:onClickNew()
|
||||
self:safe(function(frame)
|
||||
local suggestion = string.format(frame.i18n:getText("spu_newRunName"), #ADRunsController.store.runs + 1)
|
||||
TextInputDialog.show(SmartPickupFrame.onNewRunName, frame, suggestion, frame.i18n:getText("spu_renameTitle"), nil, 30, g_i18n:getText("button_ok"))
|
||||
end)
|
||||
end
|
||||
|
||||
function SmartPickupFrame:onNewRunName(value, clickOk)
|
||||
self:safe(function(frame)
|
||||
if not clickOk or value == nil or not value:match("%S") then
|
||||
return
|
||||
end
|
||||
local run = ADRunsController.createRun(value, "supply")
|
||||
frame.selectedRunId = run.id
|
||||
frame.statusOverride = nil
|
||||
frame.currentTab = SmartPickupFrame.TAB_FLOWS
|
||||
frame:switchTab(SmartPickupFrame.TAB_FLOWS)
|
||||
end)
|
||||
self:onClickFlowNew()
|
||||
end
|
||||
|
||||
function SmartPickupFrame:onClickRename()
|
||||
|
||||
@@ -103,7 +103,7 @@ function SmartPickupFrame:fillGuideRows(adEnv)
|
||||
self.guide = ADGuide.withContext(self.guide, context)
|
||||
local guide, model = self.guide, hooks.model
|
||||
self:addTextRow(hooks.heading(self, guide))
|
||||
local stepTitle = self.i18n:getText(model.stepKey(guide.step))
|
||||
local stepTitle = self.i18n:getText(model.stepKey(guide.step, guide))
|
||||
local index, total = ADGuide.position(guide)
|
||||
local header
|
||||
if guide.single then
|
||||
@@ -114,7 +114,7 @@ function SmartPickupFrame:fillGuideRows(adEnv)
|
||||
header = string.format(self.i18n:getText("spu_guide_stepOne"), index or 1, stepTitle)
|
||||
end
|
||||
self:addTextRow(header)
|
||||
self:addTextRow(" " .. self.i18n:getText(model.hintKey(guide.step)))
|
||||
self:addTextRow(" " .. self.i18n:getText(model.hintKey(guide.step, guide)))
|
||||
for _, row in ipairs(model.rows(guide)) do
|
||||
self:addGuideRow(row)
|
||||
end
|
||||
@@ -140,6 +140,8 @@ function SmartPickupFrame:onClickGuideRow(state, data)
|
||||
local option = row.options[state]
|
||||
if option == nil then return end
|
||||
value = option.value
|
||||
-- valg pr. vare (fx politik): modellen skal vide hvilken
|
||||
if row.item ~= nil then value = {item = row.item, value = option.value} end
|
||||
elseif row.type == "toggle" then
|
||||
value = state == SmartPickupFrame.STATE_ON
|
||||
elseif row.type == "check" then
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<text name="spu_title" text="Smart Pickup"/>
|
||||
<text name="spu_run" text="Run"/>
|
||||
<text name="spu_run_tooltip" text="Vælg det run du vil se eller ændre."/>
|
||||
<text name="spu_noRuns" text="Ingen runs — tryk 'Nyt run'"/>
|
||||
<text name="spu_noRuns" text="Ingen flows — tryk 'Nyt flow'"/>
|
||||
<text name="spu_target" text="Mål"/>
|
||||
<text name="spu_target_tooltip" text="AutoDrive-markør ved stalden eller fabrikken der skal fyldes."/>
|
||||
<text name="spu_noTarget" text="(vælg mål)"/>
|
||||
@@ -189,13 +189,13 @@
|
||||
<text name="spu_field_straw_chop" text="Hakkes (spredes på marken)"/>
|
||||
<text name="spu_field_straw_collect" text="Samles op til silo"/>
|
||||
<text name="spu_field_straw_bale" text="Presses til baller og samles"/>
|
||||
<text name="spu_button_start" text="Start run"/>
|
||||
<text name="spu_button_stop" text="Stop run"/>
|
||||
<text name="spu_button_new" text="Nyt run"/>
|
||||
<text name="spu_button_start" text="Start flow"/>
|
||||
<text name="spu_button_stop" text="Stop flow"/>
|
||||
<text name="spu_button_new" text="Nyt flow"/>
|
||||
<text name="spu_button_rename" text="Omdøb"/>
|
||||
<text name="spu_button_delete" text="Slet run"/>
|
||||
<text name="spu_newRunName" text="Run %d"/>
|
||||
<text name="spu_renameTitle" text="Navn på run"/>
|
||||
<text name="spu_button_delete" text="Slet flow"/>
|
||||
<text name="spu_newRunName" text="Flow %d"/>
|
||||
<text name="spu_renameTitle" text="Navn på flow"/>
|
||||
<text name="spu_deleteConfirm" text="Slet run '%s'? Dets kørende traktorer stoppes. Kan ikke fortrydes."/>
|
||||
<text name="spu_capacity" text="%s l"/>
|
||||
<text name="spu_capacity_pallets" text="autoload (paller)"/>
|
||||
@@ -390,5 +390,54 @@
|
||||
<text name="spu_guide_sum_unloaders" text="%d aflæsningsvogne"/>
|
||||
<text name="spu_guide_sum_fieldSilo" text="Marksilo"/>
|
||||
<text name="spu_guide_sum_stores" text="%d valgte siloer"/>
|
||||
<text name="spu_guide_flow_open" text="Opsæt flow"/>
|
||||
<text name="spu_guide_flow_title" text="— Opsæt flow: %s —"/>
|
||||
<text name="spu_guide_flow_section" text="— Flow: %s —"/>
|
||||
<text name="spu_guide_flow_saved" text="Flow '%s' gemt"/>
|
||||
<text name="spu_guide_flow_start" text="Start flow"/>
|
||||
<text name="spu_guide_flow_rename" text="Skift navn …"/>
|
||||
<text name="spu_guide_flow_step_name" text="Navn"/>
|
||||
<text name="spu_guide_flow_step_direction" text="Retning"/>
|
||||
<text name="spu_guide_flow_step_from" text="Fra"/>
|
||||
<text name="spu_guide_flow_step_to" text="Til"/>
|
||||
<text name="spu_guide_flow_step_goods" text="Varer"/>
|
||||
<text name="spu_guide_flow_step_store" text="Lager"/>
|
||||
<text name="spu_guide_flow_step_rules" text="Regler"/>
|
||||
<text name="spu_guide_flow_step_wait" text="Vent ved"/>
|
||||
<text name="spu_guide_flow_step_tractors" text="Traktorer"/>
|
||||
<text name="spu_guide_flow_step_summary" text="Oversigt"/>
|
||||
<text name="spu_guide_flow_hint_name" text="Flowets navn (traktorerne får navn efter det)."/>
|
||||
<text name="spu_guide_flow_hint_direction" text="Ind til bygning: fyld stalde/fabrikker. Ud fra bygning: tøm, lagr og sælg."/>
|
||||
<text name="spu_guide_flow_hint_buildings_in" text="Hvilke stalde/fabrikker skal fyldes? Markøren findes automatisk."/>
|
||||
<text name="spu_guide_flow_hint_buildings_out" text="Hvor skal der hentes fra? Markøren findes automatisk."/>
|
||||
<text name="spu_guide_flow_hint_goods_in" text="Automatisk henter hver tur den vare målet mangler mest."/>
|
||||
<text name="spu_guide_flow_hint_goods_out" text="For hver vare: Lager, Salg, eller Salg ellers lager."/>
|
||||
<text name="spu_guide_flow_hint_store" text="Hvor skal lagervarerne hen?"/>
|
||||
<text name="spu_guide_flow_hint_rules_in" text="Antal ture, og hvornår traktoren kører hjem fra Wait."/>
|
||||
<text name="spu_guide_flow_hint_rules_out" text="Hvornår der sælges, og hvornår der køres til lager."/>
|
||||
<text name="spu_guide_flow_hint_wait" text="Hvor venter traktoren med et rest-læs?"/>
|
||||
<text name="spu_guide_flow_hint_tractors" text="Hvilke traktorer kører flowet? Traktorer i andre flows vises ikke."/>
|
||||
<text name="spu_guide_flow_hint_summary" text="Tjek valgene. Tryk på en linje for at rette den."/>
|
||||
<text name="spu_guide_flow_goods" text="Varer"/>
|
||||
<text name="spu_guide_flow_goodsAutoChoice" text="Automatisk (det bygningen mangler)"/>
|
||||
<text name="spu_guide_flow_goodsAutoText" text=" Hver tur hentes den vare målet mangler mest."/>
|
||||
<text name="spu_guide_flow_noGoodsTo" text=" Vælg først hvor der skal køres til (trinnet Til)"/>
|
||||
<text name="spu_guide_flow_noProducts" text=" Vælg først hvor der hentes fra (trinnet Fra)"/>
|
||||
<text name="spu_guide_flow_storeAutoChoice" text="Automatisk (nærmeste 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_otherFlows" text=" %d traktorer kører i andre flows og vises 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_goodsAuto" text="Automatisk"/>
|
||||
<text name="spu_guide_flow_sumGoods" text="%d varer"/>
|
||||
<text name="spu_guide_flow_sumSellAt" text="sælg fra %d %%"/>
|
||||
<text name="spu_guide_flow_sumStoreAbove" text="lager over %d %%"/>
|
||||
<text name="spu_guide_flow_sumRound" text="samlerunde"/>
|
||||
<text name="spu_guide_flow_sumLoops" text="%d ture"/>
|
||||
<text name="spu_guide_flow_sumLoopsInf" text="uendelige ture"/>
|
||||
<text name="spu_guide_flow_sumReturn" text="hjem fra Wait under %d %%"/>
|
||||
<text name="spu_guide_flow_sumNoTractors" text="ingen"/>
|
||||
<text name="spu_guide_flow_sumTractors" text="%d traktorer"/>
|
||||
</texts>
|
||||
</l10n>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<text name="spu_title" text="Smart Pickup"/>
|
||||
<text name="spu_run" text="Run"/>
|
||||
<text name="spu_run_tooltip" text="Select the run to view or edit."/>
|
||||
<text name="spu_noRuns" text="No runs — press 'New run'"/>
|
||||
<text name="spu_noRuns" text="No flows — press 'New flow'"/>
|
||||
<text name="spu_target" text="Target"/>
|
||||
<text name="spu_target_tooltip" text="AutoDrive marker at the barn or factory to keep filled."/>
|
||||
<text name="spu_noTarget" text="(choose target)"/>
|
||||
@@ -189,13 +189,13 @@
|
||||
<text name="spu_field_straw_chop" text="Chopped (spread on the field)"/>
|
||||
<text name="spu_field_straw_collect" text="Collected to a silo"/>
|
||||
<text name="spu_field_straw_bale" text="Baled and collected"/>
|
||||
<text name="spu_button_start" text="Start run"/>
|
||||
<text name="spu_button_stop" text="Stop run"/>
|
||||
<text name="spu_button_new" text="New run"/>
|
||||
<text name="spu_button_start" text="Start flow"/>
|
||||
<text name="spu_button_stop" text="Stop flow"/>
|
||||
<text name="spu_button_new" text="New flow"/>
|
||||
<text name="spu_button_rename" text="Rename"/>
|
||||
<text name="spu_button_delete" text="Delete run"/>
|
||||
<text name="spu_newRunName" text="Run %d"/>
|
||||
<text name="spu_renameTitle" text="Run name"/>
|
||||
<text name="spu_button_delete" text="Delete flow"/>
|
||||
<text name="spu_newRunName" text="Flow %d"/>
|
||||
<text name="spu_renameTitle" text="Flow name"/>
|
||||
<text name="spu_deleteConfirm" text="Delete run '%s'? Its running tractors will be stopped. This cannot be undone."/>
|
||||
<text name="spu_capacity" text="%s l"/>
|
||||
<text name="spu_capacity_pallets" text="autoload (pallets)"/>
|
||||
@@ -390,5 +390,54 @@
|
||||
<text name="spu_guide_sum_unloaders" text="%d unloaders"/>
|
||||
<text name="spu_guide_sum_fieldSilo" text="Field silo"/>
|
||||
<text name="spu_guide_sum_stores" text="%d chosen silos"/>
|
||||
<text name="spu_guide_flow_open" text="Set up flow"/>
|
||||
<text name="spu_guide_flow_title" text="— Set up flow: %s —"/>
|
||||
<text name="spu_guide_flow_section" text="— Flow: %s —"/>
|
||||
<text name="spu_guide_flow_saved" text="Flow '%s' saved"/>
|
||||
<text name="spu_guide_flow_start" text="Start flow"/>
|
||||
<text name="spu_guide_flow_rename" text="Change name …"/>
|
||||
<text name="spu_guide_flow_step_name" text="Name"/>
|
||||
<text name="spu_guide_flow_step_direction" text="Direction"/>
|
||||
<text name="spu_guide_flow_step_from" text="From"/>
|
||||
<text name="spu_guide_flow_step_to" text="To"/>
|
||||
<text name="spu_guide_flow_step_goods" text="Goods"/>
|
||||
<text name="spu_guide_flow_step_store" text="Storage"/>
|
||||
<text name="spu_guide_flow_step_rules" text="Rules"/>
|
||||
<text name="spu_guide_flow_step_wait" text="Wait at"/>
|
||||
<text name="spu_guide_flow_step_tractors" text="Tractors"/>
|
||||
<text name="spu_guide_flow_step_summary" text="Summary"/>
|
||||
<text name="spu_guide_flow_hint_name" text="The flow's name (tractors are named after it)."/>
|
||||
<text name="spu_guide_flow_hint_direction" text="Into building: keep barns/factories filled. Out of building: empty, store and sell."/>
|
||||
<text name="spu_guide_flow_hint_buildings_in" text="Which barns/factories should be filled? The marker is found automatically."/>
|
||||
<text name="spu_guide_flow_hint_buildings_out" text="Where should goods be picked up? The marker is found automatically."/>
|
||||
<text name="spu_guide_flow_hint_goods_in" text="Automatic fetches whatever the target lacks most on each trip."/>
|
||||
<text name="spu_guide_flow_hint_goods_out" text="For each good: Store, Sell, or Sell else store."/>
|
||||
<text name="spu_guide_flow_hint_store" text="Where should stored goods go?"/>
|
||||
<text name="spu_guide_flow_hint_rules_in" text="Number of trips, and when the tractor leaves Wait."/>
|
||||
<text name="spu_guide_flow_hint_rules_out" text="When to sell, and when to drive to storage."/>
|
||||
<text name="spu_guide_flow_hint_wait" text="Where does the tractor wait with a leftover load?"/>
|
||||
<text name="spu_guide_flow_hint_tractors" text="Which tractors run this flow? Tractors in other flows are hidden."/>
|
||||
<text name="spu_guide_flow_hint_summary" text="Check your choices. Click a line to change it."/>
|
||||
<text name="spu_guide_flow_goods" text="Goods"/>
|
||||
<text name="spu_guide_flow_goodsAutoChoice" text="Automatic (what the building needs)"/>
|
||||
<text name="spu_guide_flow_goodsAutoText" text=" Each trip fetches the good the target lacks most."/>
|
||||
<text name="spu_guide_flow_noGoodsTo" text=" First choose where to deliver (step To)"/>
|
||||
<text name="spu_guide_flow_noProducts" text=" First choose where to pick up (step From)"/>
|
||||
<text name="spu_guide_flow_storeAutoChoice" text="Automatic (nearest 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_otherFlows" text=" %d tractors run in other flows and are hidden"/>
|
||||
<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_goodsAuto" text="Automatic"/>
|
||||
<text name="spu_guide_flow_sumGoods" text="%d goods"/>
|
||||
<text name="spu_guide_flow_sumSellAt" text="sell from %d %%"/>
|
||||
<text name="spu_guide_flow_sumStoreAbove" text="store above %d %%"/>
|
||||
<text name="spu_guide_flow_sumRound" text="collection round"/>
|
||||
<text name="spu_guide_flow_sumLoops" text="%d trips"/>
|
||||
<text name="spu_guide_flow_sumLoopsInf" text="endless trips"/>
|
||||
<text name="spu_guide_flow_sumReturn" text="leave Wait below %d %%"/>
|
||||
<text name="spu_guide_flow_sumNoTractors" text="none"/>
|
||||
<text name="spu_guide_flow_sumTractors" text="%d tractors"/>
|
||||
</texts>
|
||||
</l10n>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.31.0.0</version>
|
||||
<version>1.32.0.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
@@ -24,6 +24,7 @@
|
||||
<sourceFile filename="adStorageStats.lua"/>
|
||||
<sourceFile filename="adFlowView.lua"/>
|
||||
<sourceFile filename="adGuide.lua"/>
|
||||
<sourceFile filename="adFlowGuide.lua"/>
|
||||
<sourceFile filename="adSources.lua"/>
|
||||
<sourceFile filename="adBuildings.lua"/>
|
||||
<sourceFile filename="adOutbound.lua"/>
|
||||
|
||||
Reference in New Issue
Block a user