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") return table.concat(resultParts, "\n")
end 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() function SendLogisticStats()
if options.enableRobots then if options.enableRobots then
helpers.send_udp(udpAddress,GetAllLogisticGrids(),serverIndex) local send = GetAllLogisticGrids()..GetLogisticNetworkContents()
helpers.send_udp(udpAddress,send,serverIndex)
end end
end end

View File

@@ -152,6 +152,7 @@ end
function SendTrainStats() function SendTrainStats()
if options.enableTrains then
ScanTrains() ScanTrains()
local returnParts = {} local returnParts = {}
returnParts[#returnParts+1] = GetTrainPlayerKills() returnParts[#returnParts+1] = GetTrainPlayerKills()
@@ -159,4 +160,5 @@ function SendTrainStats()
returnParts[#returnParts+1] = GetTrainStates() returnParts[#returnParts+1] = GetTrainStates()
returnParts[#returnParts+1] = GetTrainStatistics() returnParts[#returnParts+1] = GetTrainStatistics()
helpers.send_udp(udpAddress,table.concat(returnParts,"\n"),serverIndex) helpers.send_udp(udpAddress,table.concat(returnParts,"\n"),serverIndex)
end
end end