feat(udkørsel): 'Lager til' — tvunget aflæsningssted pr. flow (siloer/egne fabrikker; første med plads og vej), XML #storeBuildings (v1.18.0.0)
This commit is contained in:
@@ -47,6 +47,7 @@ local function copyRun(run)
|
||||
sourceWayPointIds = copyList(run.sourceWayPointIds),
|
||||
sourceBuildingIds = copyList(run.sourceBuildingIds),
|
||||
targetBuildingIds = copyList(run.targetBuildingIds),
|
||||
storeBuildingIds = copyList(run.storeBuildingIds),
|
||||
products = copyProducts(run.products),
|
||||
sellAtPercent = run.sellAtPercent,
|
||||
storeAbovePercent = run.storeAbovePercent,
|
||||
@@ -93,6 +94,7 @@ function ADRuns.createRun(store, name, kind)
|
||||
sourceWayPointIds = {},
|
||||
sourceBuildingIds = {},
|
||||
targetBuildingIds = {},
|
||||
storeBuildingIds = {},
|
||||
products = {},
|
||||
sellAtPercent = ADRuns.DEFAULT_SELL_AT_PERCENT,
|
||||
storeAbovePercent = ADRuns.DEFAULT_STORE_ABOVE_PERCENT,
|
||||
@@ -158,6 +160,7 @@ function ADRuns.updateRun(store, runId, changes)
|
||||
if changes.sourceWayPointIds ~= nil then run.sourceWayPointIds = copyList(changes.sourceWayPointIds) end
|
||||
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.products ~= nil then run.products = copyProducts(changes.products) end
|
||||
if changes.sellAtPercent ~= nil then run.sellAtPercent = clampRange(changes.sellAtPercent, ADRuns.DEFAULT_SELL_AT_PERCENT, ADRuns.MIN_SELL_AT_PERCENT, ADRuns.MAX_SELL_AT_PERCENT) end
|
||||
if changes.storeAbovePercent ~= nil then run.storeAbovePercent = clampRange(changes.storeAbovePercent, ADRuns.DEFAULT_STORE_ABOVE_PERCENT, ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT) end
|
||||
@@ -182,6 +185,13 @@ function ADRuns.toggleSourceBuilding(store, runId, buildingId)
|
||||
return ADRuns.updateRun(store, runId, {sourceBuildingIds = toggleInList(run.sourceBuildingIds, buildingId)})
|
||||
end
|
||||
|
||||
-- Tvunget lagermål for udkørsel: lagerture kører KUN til disse bygninger (tom = moden vælger selv).
|
||||
function ADRuns.toggleStoreBuilding(store, runId, buildingId)
|
||||
local run = ADRuns.getRun(store, runId)
|
||||
if run == nil then return copyStore(store) end
|
||||
return ADRuns.updateRun(store, runId, {storeBuildingIds = toggleInList(run.storeBuildingIds, buildingId)})
|
||||
end
|
||||
|
||||
function ADRuns.toggleTargetBuilding(store, runId, buildingId)
|
||||
local run = ADRuns.getRun(store, runId)
|
||||
if run == nil then return copyStore(store) end
|
||||
@@ -350,6 +360,7 @@ function ADRuns.toRecords(store)
|
||||
sources = table.concat(run.sourceWayPointIds or {}, " "),
|
||||
sourceBuildings = table.concat(run.sourceBuildingIds or {}, " "),
|
||||
targetBuildings = table.concat(run.targetBuildingIds or {}, " "),
|
||||
storeBuildings = table.concat(run.storeBuildingIds or {}, " "),
|
||||
products = ADRuns.serializeProducts(run.products),
|
||||
sellAt = run.sellAtPercent,
|
||||
storeAbove = run.storeAbovePercent,
|
||||
@@ -392,6 +403,7 @@ function ADRuns.fromRecords(records)
|
||||
sourceWayPointIds = sources,
|
||||
sourceBuildingIds = parseIds(record.sourceBuildings),
|
||||
targetBuildingIds = parseIds(record.targetBuildings),
|
||||
storeBuildingIds = parseIds(record.storeBuildings),
|
||||
products = ADRuns.parseProducts(record.products),
|
||||
sellAtPercent = clampRange(record.sellAt, ADRuns.DEFAULT_SELL_AT_PERCENT, ADRuns.MIN_SELL_AT_PERCENT, ADRuns.MAX_SELL_AT_PERCENT),
|
||||
storeAbovePercent = clampRange(record.storeAbove, ADRuns.DEFAULT_STORE_ABOVE_PERCENT, ADRuns.MIN_STORE_ABOVE_PERCENT, ADRuns.MAX_STORE_ABOVE_PERCENT),
|
||||
|
||||
Reference in New Issue
Block a user