feat(mp): etape 1 - automatik kun på serveren, fælles gård via ADUtil.farmId, klienter skriver aldrig modens filer
This commit is contained in:
@@ -39,7 +39,7 @@ function ADRunsController.getVehicleId(vehicle)
|
||||
end
|
||||
|
||||
function ADRunsController.getFarmVehicles(adEnv)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local result = {}
|
||||
for _, vehicle in pairs(adEnv.AutoDrive.getAllVehicles()) do
|
||||
-- kun motoriserede (traktorer, høstere); AD-spec'en sidder også på redskaber
|
||||
@@ -197,7 +197,7 @@ function ADRunsController.canStoreAt(adEnv, building, goods)
|
||||
if building.unloadMarker == nil or ADLoadSwap == nil or ADLoadSwap.isStoreTarget == nil then
|
||||
return false
|
||||
end
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
local station = ADSmartPickup.getUnloadStationAtWayPointId(adEnv, building.unloadMarker.id, farmId)
|
||||
if station == nil then
|
||||
return false
|
||||
@@ -215,7 +215,7 @@ end
|
||||
function ADRunsController.getStoreBuildings(adEnv, run)
|
||||
local result = {}
|
||||
if ADBuildings == nil or run == nil then return result end
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
for _, buildingId in ipairs(run.storeBuildingIds or {}) do
|
||||
local building = ADBuildings.find(adEnv, farmId, buildingId)
|
||||
if building ~= nil then table.insert(result, building) end
|
||||
@@ -227,7 +227,7 @@ end
|
||||
function ADRunsController.getFeedBuildings(adEnv, run)
|
||||
local result = {}
|
||||
if ADBuildings == nil or run == nil then return result end
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
for _, buildingId in ipairs(run.feedBuildingIds or {}) do
|
||||
local building = ADBuildings.find(adEnv, farmId, buildingId)
|
||||
if building ~= nil then table.insert(result, building) end
|
||||
@@ -239,7 +239,7 @@ end
|
||||
function ADRunsController.getStoreMarkers(adEnv, run)
|
||||
local result = {}
|
||||
if ADBuildings == nil or run == nil then return result end
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
for _, buildingId in ipairs(run.storeBuildingIds or {}) do
|
||||
local building = ADBuildings.find(adEnv, farmId, buildingId)
|
||||
if building ~= nil and building.unloadMarker ~= nil then
|
||||
@@ -485,7 +485,7 @@ end
|
||||
|
||||
-- Alle varer målet tager (uanset vogn) — afkrydsningslisten i GUI'et. {index, name, title}, sorteret på titel.
|
||||
function ADRunsController.getTargetAcceptedFillTypes(adEnv, run)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local stations = getTargetStations(adEnv, run, farmId)
|
||||
if #stations == 0 then
|
||||
return {}
|
||||
@@ -615,7 +615,7 @@ function ADRunsController.resolveMarkers(adEnv, run)
|
||||
if ADBuildings == nil or run == nil then
|
||||
return {missing = missing}
|
||||
end
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local role = run.kind == "outbound" and "load" or "unload"
|
||||
local buildingIds = run.kind == "outbound" and run.sourceBuildingIds or run.targetBuildingIds
|
||||
local existing = run.kind == "outbound" and run.sourceWayPointIds or ADRunsController.getRunTargets(run)
|
||||
@@ -709,7 +709,7 @@ function ADRunsController.migrateBuildings(adEnv)
|
||||
if ADBuildings == nil then
|
||||
return
|
||||
end
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
for _, run in ipairs(ADRunsController.store.runs) do
|
||||
local role = run.kind == "outbound" and "load" or "unload"
|
||||
local ids = copyList(run.kind == "outbound" and run.sourceBuildingIds or run.targetBuildingIds)
|
||||
@@ -734,7 +734,7 @@ end
|
||||
|
||||
-- Data til én række i flow-tavlen (GUI'et formaterer teksten).
|
||||
function ADRunsController.getFlowRow(adEnv, run)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local row = {productNames = {}, productAuto = false, fromNames = {}, toNames = {}, fromAllSilos = run.kind ~= "outbound", missing = {}, policies = {}, vehicleNames = {}, collectRound = run.collectRound == true, sellAtPercent = run.sellAtPercent, storeAbovePercent = run.storeAbovePercent, loops = run.loops, kind = run.kind}
|
||||
local ids = run.kind == "outbound" and run.sourceBuildingIds or run.targetBuildingIds
|
||||
local names = run.kind == "outbound" and row.fromNames or row.toNames
|
||||
@@ -862,7 +862,7 @@ end
|
||||
-- Alle varer kilderne rummer/producerer med run'ets politik (uanset vogn) — til fanen Udkørsel.
|
||||
-- {fillType, name, title, policy, isPallet, available, level, capacity}, sorteret på titel.
|
||||
function ADRunsController.getRunProducts(adEnv, run, includeEmpty)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local byName, result = {}, {}
|
||||
for _, source in ipairs(getRunSources(adEnv, run, farmId)) do
|
||||
for _, item in ipairs(ADSources.getProducts(adEnv, source, farmId, includeEmpty)) do
|
||||
@@ -1745,7 +1745,7 @@ end
|
||||
-- Niveauer pr. mål for run'ets varer: {{wayPointId, name, levels = {{fillType, level, capacity, free}}}}
|
||||
-- i samme rangering som valget bruger (trug som én trang, fodervægt som prioritet); fulde sidst.
|
||||
function ADRunsController.getTargetsLevels(adEnv, run)
|
||||
local farmId = g_currentMission:getFarmId()
|
||||
local farmId = ADUtil.farmId()
|
||||
local fillTypes = {}
|
||||
if run.ingredientMode == "manual" then
|
||||
for _, name in ipairs(run.ingredients) do
|
||||
|
||||
Reference in New Issue
Block a user