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:
@@ -514,7 +514,7 @@ local function getSiloProducts(source, includeEmpty)
|
||||
-- storageRadius: tanken selv kan være tom mens puljen er fuld. Læssestationens tal er det man kan hente.
|
||||
local station = source.station
|
||||
if station ~= nil and station.getAllFillLevels ~= nil then
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
local ok, pooled, pooledCapacity = pcall(station.getAllFillLevels, station, farmId)
|
||||
if ok and type(pooled) == "table" then
|
||||
for fillType, level in pairs(pooled) do
|
||||
@@ -631,7 +631,7 @@ end
|
||||
|
||||
local function getHusbandryProducts(adEnv, source)
|
||||
local placeable, station = source.placeable, source.station
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
if station == nil then
|
||||
-- kilde via staldens pallespawner (hønsehus: æg): kun pallevarerne
|
||||
return getHusbandryPalletProducts(source, farmId)
|
||||
@@ -656,7 +656,7 @@ local function getHusbandryProducts(adEnv, source)
|
||||
-- en siloExtension inden for storageRadius). getHusbandryFillLevel ser kun staldens egen beholder.
|
||||
local stationLevels = nil
|
||||
if station ~= nil and station.getAllFillLevels ~= nil then
|
||||
local ok, levels = pcall(station.getAllFillLevels, station, g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1)
|
||||
local ok, levels = pcall(station.getAllFillLevels, station, ADUtil.farmId())
|
||||
if ok and type(levels) == "table" then stationLevels = levels end
|
||||
end
|
||||
local products = {}
|
||||
@@ -678,7 +678,7 @@ local function getStationProducts(source)
|
||||
if station == nil or station.getAllFillLevels == nil then
|
||||
return {}
|
||||
end
|
||||
local farmId = g_currentMission ~= nil and g_currentMission.getFarmId ~= nil and g_currentMission:getFarmId() or 1
|
||||
local farmId = ADUtil.farmId()
|
||||
local ok, levels, capacity = pcall(station.getAllFillLevels, station, farmId)
|
||||
if not ok or type(levels) ~= "table" then
|
||||
return {}
|
||||
@@ -1530,7 +1530,7 @@ local function getHusbandryStationLevels(placeable)
|
||||
if storage == nil or storage.getLoadingStations == nil then return result end
|
||||
for _, station in pairs(storage:getLoadingStations()) do
|
||||
if station.owningPlaceable == placeable and station.getAllFillLevels ~= nil then
|
||||
local ok, levels = pcall(station.getAllFillLevels, station, g_currentMission:getFarmId())
|
||||
local ok, levels = pcall(station.getAllFillLevels, station, ADUtil.farmId())
|
||||
for fillType, level in pairs(ok and type(levels) == "table" and levels or {}) do
|
||||
result[fillType] = math.max(result[fillType] or 0, level or 0)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user