Add logistic network contents retrieval to SendLogisticStats function
This commit is contained in:
@@ -17,8 +17,23 @@ function GetAllLogisticGrids()
|
||||
return table.concat(resultParts, "\n")
|
||||
end
|
||||
|
||||
function GetLogisticNetworkContents()
|
||||
local resultParts = {}
|
||||
resultParts[#resultParts+1] = "---logistic-grids-contents---\n"
|
||||
for _,surface in pairs(game.surfaces) do
|
||||
local grids = game.forces["player"].logistic_networks[surface.name]
|
||||
for _,grid in pairs(grids) do
|
||||
for _,itemWithQuality in pairs(grid.get_contents())do
|
||||
resultParts[#resultParts+1] = ("%s:%d:%s:%d"):format(surface.name,grid.network_id,itemWithQuality.name..":"..itemWithQuality.quality,itemWithQuality.count)
|
||||
end
|
||||
end
|
||||
end
|
||||
return table.concat(resultParts, "\n")
|
||||
end
|
||||
|
||||
function SendLogisticStats()
|
||||
if options.enableRobots then
|
||||
helpers.send_udp(udpAddress,GetAllLogisticGrids(),serverIndex)
|
||||
local send = GetAllLogisticGrids()..GetLogisticNetworkContents()
|
||||
helpers.send_udp(udpAddress,send,serverIndex)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user