feat: udkørsel kan sælge alt gården ikke bruger + politikken Behold (1.62.378)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
ADFlowGuide = {}
|
||||
|
||||
ADFlowGuide.ORDER = {"name", "direction", "buildings", "goods", "store", "rules", "wait", "tractors", "summary"}
|
||||
ADFlowGuide.POLICIES = {"off", "store", "sell", "sellElseStore"}
|
||||
ADFlowGuide.POLICIES = {"off", "store", "sell", "sellElseStore", "keep"}
|
||||
ADFlowGuide.MAX_NAMED_TRACTORS = 3
|
||||
ADFlowGuide.MAX_NAMED_GOODS = 3
|
||||
|
||||
@@ -69,7 +69,7 @@ end
|
||||
local RUN_FIELDS = {
|
||||
"id", "name", "kind", "sourceBuildingIds", "targetBuildingIds", "storeBuildingIds", "products",
|
||||
"ingredientMode", "ingredients", "sellAtPercent", "storeAbovePercent", "sellAbovePercent", "minSourcePercent", "collectRound", "loops",
|
||||
"returnBelowPercent", "waitPoolGroup", "vehicleIds", "wagons", "chain", "spareWagons", "borrowWagonId",
|
||||
"returnBelowPercent", "waitPoolGroup", "vehicleIds", "wagons", "chain", "spareWagons", "borrowWagonId", "sellUnused",
|
||||
}
|
||||
|
||||
local function draftFrom(run, isNew)
|
||||
@@ -180,7 +180,7 @@ local SET_VALUES = {
|
||||
kind = true, ingredientMode = true, sellAtPercent = true, storeAbovePercent = true, sellAbovePercent = true, minSourcePercent = true, loops = true,
|
||||
returnBelowPercent = true, waitPoolGroup = true, borrowWagonId = true,
|
||||
}
|
||||
local BOOL_VALUES = {showAllBuildings = true, storeAuto = true, collectRound = true, borrowTractor = true}
|
||||
local BOOL_VALUES = {showAllBuildings = true, storeAuto = true, collectRound = true, borrowTractor = true, sellUnused = true}
|
||||
local LIST_VALUES = {ingredients = true, storeBuildingIds = true, vehicleIds = true}
|
||||
|
||||
local function setPolicy(products, name, policy)
|
||||
@@ -241,7 +241,7 @@ ADFlowGuide.TOOLTIPS = {
|
||||
policy = "spu_policy_tooltip", ingredientMode = "spu_ingredientMode_tooltip", sellAtPercent = "spu_sellAt_tooltip",
|
||||
storeAbovePercent = "spu_storeAbove_tooltip", sellAbovePercent = "spu_sellAbove_tooltip", minSourcePercent = "spu_minSource_tooltip",
|
||||
collectRound = "spu_collectRound_tooltip", loops = "spu_loops_tooltip", returnBelowPercent = "spu_returnBelow_tooltip",
|
||||
waitPoolGroup = "spu_waitPool_tooltip", borrowTractor = "spu_guide_flow_borrow_tooltip", borrowWagonId = "spu_guide_flow_borrowWagon_tooltip",
|
||||
waitPoolGroup = "spu_waitPool_tooltip", sellUnused = "spu_guide_flow_sellUnused_tooltip", borrowTractor = "spu_guide_flow_borrow_tooltip", borrowWagonId = "spu_guide_flow_borrowWagon_tooltip",
|
||||
}
|
||||
|
||||
local function choice(id, title, options, value, item)
|
||||
@@ -327,6 +327,8 @@ local function rowsGoods(guide)
|
||||
end
|
||||
local options = {}
|
||||
for _, policy in ipairs(ADFlowGuide.POLICIES) do table.insert(options, {label = L("spu_policy_" .. policy), value = policy}) end
|
||||
-- øverst: sælg alt, gården ikke bruger (varerne mærket "ikke brugt på gården"; valgte varer følger deres egen politik)
|
||||
table.insert(rows, toggle("sellUnused", L("spu_guide_flow_sellUnused"), draft.sellUnused))
|
||||
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
|
||||
@@ -365,6 +367,7 @@ end
|
||||
local function productPolicies(draft)
|
||||
local policies = {}
|
||||
for _, product in ipairs(draft.products or {}) do table.insert(policies, product.policy) end
|
||||
if draft.sellUnused then table.insert(policies, "sell") end
|
||||
return policies
|
||||
end
|
||||
|
||||
@@ -594,6 +597,7 @@ local SUMMARY = {
|
||||
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 draft.sellUnused then table.insert(parts, L("spu_guide_flow_sumSellUnused")) end
|
||||
if #parts == 0 then return {L("spu_guide_flow_none")} end
|
||||
return parts
|
||||
end
|
||||
@@ -680,7 +684,7 @@ function ADFlowGuide.result(guide)
|
||||
products = ADGuide.deepCopy(draft.products), ingredientMode = draft.ingredientMode,
|
||||
ingredients = ADGuide.deepCopy(draft.ingredients), sellAtPercent = draft.sellAtPercent,
|
||||
storeAbovePercent = draft.storeAbovePercent, sellAbovePercent = draft.sellAbovePercent or 0,
|
||||
minSourcePercent = draft.minSourcePercent or 0,
|
||||
minSourcePercent = draft.minSourcePercent or 0, sellUnused = draft.sellUnused == true,
|
||||
collectRound = draft.collectRound, loops = draft.loops,
|
||||
returnBelowPercent = draft.returnBelowPercent, waitPoolGroup = draft.waitPoolGroup or "",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user