Private
Public Access
1
0

Add logistic network contents retrieval to SendLogisticStats function

This commit is contained in:
Jan Grießhaber
2026-01-03 16:55:29 +01:00
parent 549dce713d
commit e571c3b9cc
2 changed files with 18 additions and 1 deletions

View File

@@ -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