fix(flows): én læssemarkør pr. læssestation (mælk OG gylle på samme stald), naturlig navnesortering af bygninger (v1.13.1.0)
This commit is contained in:
@@ -586,14 +586,22 @@ ADUnloadWait = nil; ADOutbound = nil; ADSources = nil
|
||||
|
||||
-- C-flow: bygninger -> markører (resolveMarkers), migration af gamle markør-runs, noMarker, flow-rækker
|
||||
local buildings = {
|
||||
{id = "barn1", name = "Kostald 1", kind = "husbandry", loadMarker = {id = 10, name = "cow 1 milk", distance = 5}, unloadMarker = {id = 94, name = "Cow 1 Food", distance = 8}, canBeSource = true, canBeTarget = true, canSell = false},
|
||||
{id = "barn1", name = "Kostald 1", kind = "husbandry", loadMarker = {id = 10, name = "cow 1 milk", distance = 5}, loadMarkers = {{id = 10, name = "cow 1 milk", distance = 5}, {id = 11, name = "cow 1 slurry", distance = 3}}, unloadMarker = {id = 94, name = "Cow 1 Food", distance = 8}, canBeSource = true, canBeTarget = true, canSell = false},
|
||||
{id = "shed", name = "Palleskur", kind = "objectStorage", loadMarker = nil, unloadMarker = nil, canBeSource = true, canBeTarget = false, canSell = false},
|
||||
{id = "mill", name = "Sukkerfabrik", kind = "factory", loadMarker = {id = 12694, name = "Suger Load", distance = 3}, unloadMarker = {id = 77, name = "sugar offload", distance = 4}, canBeSource = true, canBeTarget = true, canSell = false},
|
||||
}
|
||||
ADBuildings = {
|
||||
list = function() return buildings end,
|
||||
find = function(_, _, id) for _, b in ipairs(buildings) do if b.id == id then return b end end end,
|
||||
byMarker = function(_, _, wayPointId, role) for _, b in ipairs(buildings) do local m = role == "unload" and b.unloadMarker or b.loadMarker if m ~= nil and m.id == wayPointId then return b end end end,
|
||||
byMarker = function(_, _, wayPointId, role)
|
||||
for _, b in ipairs(buildings) do
|
||||
if role == "unload" then
|
||||
if b.unloadMarker ~= nil and b.unloadMarker.id == wayPointId then return b end
|
||||
else
|
||||
for _, m in ipairs(b.loadMarkers or {b.loadMarker}) do if m ~= nil and m.id == wayPointId then return b end end
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
ADSources = {identify = function(_, id) return (id == 10 or id == 12694 or id == 555) and {kind = "x", wayPointId = id, name = "k"} or nil end, getProducts = function() return {} end, getSellMarkers = function() return {} end, stationAccepts = function() return false end, getSourcePlaceables = function() return {} end}
|
||||
ADOutbound = {isOutboundVehicle = function() return false end, getRunStatus = function() return {reasons = {"SUGAR 78 % af top"}} end, getHoldFor = function() return nil end, getTripFor = function() return nil end, releaseInactive = function() end}
|
||||
@@ -605,12 +613,12 @@ addMarker(77, "sugar offload", "production", 950, 0); unloadAt[77] = {accepts =
|
||||
local flowOut = ADRunsController.createRun("Milk", "outbound")
|
||||
ADRunsController.updateRun(flowOut.id, {sourceBuildingIds = {"barn1", "shed"}, sourceWayPointIds = {555}})
|
||||
local resolved = ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, flowOut.id))
|
||||
check("CF1 kildemarkører = bygningens + rå", table.concat(ADRuns.getRun(ADRunsController.store, flowOut.id).sourceWayPointIds, ","), "10,555")
|
||||
check("CF1 kildemarkører = ALLE bygningens læssemarkører + rå", table.concat(ADRuns.getRun(ADRunsController.store, flowOut.id).sourceWayPointIds, ","), "10,11,555")
|
||||
check("CF1 manglende markør", resolved.missing[1], "Palleskur")
|
||||
-- en markør der HØRER til en bygning som ikke længere er valgt, fjernes (den er ikke rå)
|
||||
ADRunsController.updateRun(flowOut.id, {sourceWayPointIds = {12694, 555}})
|
||||
ADRunsController.resolveMarkers(adEnv, ADRuns.getRun(ADRunsController.store, flowOut.id))
|
||||
check("CF1 fravalgt bygnings markør fjernes", table.concat(ADRuns.getRun(ADRunsController.store, flowOut.id).sourceWayPointIds, ","), "10,555")
|
||||
check("CF1 fravalgt bygnings markør fjernes", table.concat(ADRuns.getRun(ADRunsController.store, flowOut.id).sourceWayPointIds, ","), "10,11,555")
|
||||
-- CF2: forsyning: mål-bygninger -> targetWayPointIds + targetWayPointId
|
||||
local flowIn = ADRunsController.createRun("Foder", "supply")
|
||||
ADRunsController.updateRun(flowIn.id, {targetBuildingIds = {"barn1", "mill"}})
|
||||
|
||||
Reference in New Issue
Block a user