feat: udkørsel "Lever også til" (fodring med samme vogn) + låst traktor og vogn til flowet
This commit is contained in:
@@ -196,6 +196,7 @@ local function copyRun(run)
|
||||
sourceBuildingIds = copyList(run.sourceBuildingIds),
|
||||
targetBuildingIds = copyList(run.targetBuildingIds),
|
||||
storeBuildingIds = copyList(run.storeBuildingIds),
|
||||
feedBuildingIds = copyList(run.feedBuildingIds), -- udkørsel: "Lever også til" (bygninger der fodres først)
|
||||
products = copyProducts(run.products),
|
||||
sellAtPercent = run.sellAtPercent,
|
||||
storeAbovePercent = run.storeAbovePercent,
|
||||
@@ -219,6 +220,7 @@ local function copyRun(run)
|
||||
spareWagons = ADRuns.copySpares(run.spareWagons),
|
||||
parkedLoaded = ADRuns.copyParked(run.parkedLoaded),
|
||||
sellUnused = run.sellUnused == true or nil, -- udkørsel: sælg alt, gården ikke bruger
|
||||
lockSet = run.lockSet == true or nil, -- traktor+vogn lånes aldrig ud og køres ikke hjem (fjerne områder)
|
||||
borrowWagonId = run.borrowWagonId, -- flow uden fast traktor: vognen en lånt traktor henter (ADFlowSleep)
|
||||
}
|
||||
end
|
||||
@@ -256,6 +258,7 @@ function ADRuns.createRun(store, name, kind)
|
||||
sourceBuildingIds = {},
|
||||
targetBuildingIds = {},
|
||||
storeBuildingIds = {},
|
||||
feedBuildingIds = {},
|
||||
products = {},
|
||||
sellAtPercent = ADRuns.DEFAULT_SELL_AT_PERCENT,
|
||||
storeAbovePercent = ADRuns.DEFAULT_STORE_ABOVE_PERCENT,
|
||||
@@ -330,6 +333,7 @@ function ADRuns.updateRun(store, runId, changes)
|
||||
if changes.sourceBuildingIds ~= nil then run.sourceBuildingIds = copyList(changes.sourceBuildingIds) end
|
||||
if changes.targetBuildingIds ~= nil then run.targetBuildingIds = copyList(changes.targetBuildingIds) end
|
||||
if changes.storeBuildingIds ~= nil then run.storeBuildingIds = copyList(changes.storeBuildingIds) end
|
||||
if changes.feedBuildingIds ~= nil then run.feedBuildingIds = copyList(changes.feedBuildingIds) end
|
||||
if changes.products ~= nil then run.products = copyProducts(changes.products) end
|
||||
-- 0 = "Altid" (sælg uanset pris); ellers 50-100 %
|
||||
if changes.sellAtPercent ~= nil then run.sellAtPercent = sellAtValue(changes.sellAtPercent) end
|
||||
@@ -339,6 +343,7 @@ function ADRuns.updateRun(store, runId, changes)
|
||||
if changes.collectRound ~= nil then run.collectRound = changes.collectRound == true end
|
||||
if changes.chain ~= nil then run.chain = tostring(changes.chain) end
|
||||
if changes.sellUnused ~= nil then run.sellUnused = changes.sellUnused == true or nil end
|
||||
if changes.lockSet ~= nil then run.lockSet = changes.lockSet == true or nil end
|
||||
-- false = flowet har igen faste traktorer
|
||||
if changes.borrowWagonId == false then run.borrowWagonId = nil
|
||||
elseif type(changes.borrowWagonId) == "string" and changes.borrowWagonId ~= "" then run.borrowWagonId = changes.borrowWagonId end
|
||||
@@ -611,6 +616,7 @@ function ADRuns.toRecords(store)
|
||||
sourceBuildings = table.concat(run.sourceBuildingIds or {}, " "),
|
||||
targetBuildings = table.concat(run.targetBuildingIds or {}, " "),
|
||||
storeBuildings = table.concat(run.storeBuildingIds or {}, " "),
|
||||
feedBuildings = table.concat(run.feedBuildingIds or {}, " "),
|
||||
products = ADRuns.serializeProducts(run.products),
|
||||
sellAt = run.sellAtPercent,
|
||||
storeAbove = run.storeAbovePercent,
|
||||
@@ -626,6 +632,7 @@ function ADRuns.toRecords(store)
|
||||
parkedLoaded = ADRuns.serializeParked(run.parkedLoaded),
|
||||
borrowWagon = run.borrowWagonId or "",
|
||||
sellUnused = run.sellUnused and 1 or 0,
|
||||
lockSet = run.lockSet and 1 or 0,
|
||||
}
|
||||
end
|
||||
return records
|
||||
@@ -667,6 +674,7 @@ function ADRuns.fromRecords(records)
|
||||
sourceBuildingIds = parseIds(record.sourceBuildings),
|
||||
targetBuildingIds = parseIds(record.targetBuildings),
|
||||
storeBuildingIds = parseIds(record.storeBuildings),
|
||||
feedBuildingIds = parseIds(record.feedBuildings), -- nil i gemme fra før feltet -> tom
|
||||
products = ADRuns.parseProducts(record.products),
|
||||
sellAtPercent = sellAtValue(record.sellAt),
|
||||
storeAbovePercent = clampRange(record.storeAbove, ADRuns.DEFAULT_STORE_ABOVE_PERCENT, ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT),
|
||||
@@ -690,6 +698,7 @@ function ADRuns.fromRecords(records)
|
||||
parkedLoaded = ADRuns.parseParked(record.parkedLoaded), -- nil i gemme fra før feltet -> tom
|
||||
borrowWagonId = (record.borrowWagon ~= nil and record.borrowWagon ~= "") and record.borrowWagon or nil,
|
||||
sellUnused = tonumber(record.sellUnused) == 1 or nil,
|
||||
lockSet = tonumber(record.lockSet) == 1 or nil,
|
||||
})
|
||||
store.nextId = math.max(store.nextId, id + 1)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user