Initial Commit
This commit is contained in:
18
pollution-stats.lua
Normal file
18
pollution-stats.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
function GetPollutionStats()
|
||||
for _,surface in pairs(game.surfaces) do
|
||||
local surface_name = surface.name
|
||||
local pollutionParts = {}
|
||||
local pollution_stats = game.surfaces[surface_name].pollution_statistics
|
||||
local pollution_input = pollution_stats.input_counts
|
||||
local pollution_output = pollution_stats.output_counts
|
||||
pollutionParts[#pollutionParts+1] = ("---pollution-input---%s\n"):format(surface_name)
|
||||
for name, stat in pairs(pollution_input) do
|
||||
pollutionParts[#pollutionParts+1] = ("%s:%d"):format(name, stat)
|
||||
end
|
||||
pollutionParts[#pollutionParts+1] = ("---pollution-output---%s\n"):format(surface_name)
|
||||
for name, stat in pairs(pollution_output) do
|
||||
pollutionParts[#pollutionParts+1] = ("%s:%d"):format(name, stat)
|
||||
end
|
||||
helpers.send_udp(52555, table.concat(pollutionParts,"\n"),1)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user