Add metrics combinator entity, GUI, and related functionality; enhance power and production stats tracking
Greatly improved train trip perfomance by culling table after sending Fixed formatting in many places
This commit is contained in:
@@ -1,3 +1,27 @@
|
||||
protos = {}
|
||||
--Experimental function, not in use right now
|
||||
function GetProductionWithQuality(surface)
|
||||
|
||||
log("StartQualProd"..surface.name)
|
||||
local prodWithQualityParts = {}
|
||||
local prodstat = game.forces["player"].get_item_production_statistics(surface)
|
||||
for key, _ in pairs(prodstat.input_counts) do
|
||||
for quality,_ in pairs(prototypes.quality) do
|
||||
local count = prodstat.get_input_count({name=key,quality=quality})
|
||||
if count > 0 then
|
||||
prodWithQualityParts[#prodWithQualityParts+1] =
|
||||
surface.name..":"..
|
||||
key..":"..
|
||||
quality..":"..
|
||||
count
|
||||
end
|
||||
end
|
||||
end
|
||||
log("EndQualProd"..surface.name)
|
||||
return table.concat(prodWithQualityParts,"\n")
|
||||
end
|
||||
|
||||
|
||||
function SendProductionStats()
|
||||
if options.enableProduction then
|
||||
local productionParts = {}
|
||||
@@ -5,6 +29,9 @@ function SendProductionStats()
|
||||
for _,surface in pairs(game.surfaces) do
|
||||
local surfaceName = surface.name
|
||||
|
||||
--TODO
|
||||
--local test = GetProductionWithQuality(surface)
|
||||
|
||||
local inputStats = game.forces["player"].get_item_production_statistics(surfaceName).input_counts
|
||||
local outputStats = game.forces["player"].get_item_production_statistics(surfaceName).output_counts
|
||||
|
||||
@@ -80,4 +107,13 @@ function SendBuildStats()
|
||||
end
|
||||
helpers.send_udp(udpAddress, table.concat(buildParts, "\n"), serverIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function GetAllPrototypes()
|
||||
for ID, _ in pairs(prototypes.item) do
|
||||
for quality,_ in pairs(prototypes.quality) do
|
||||
protos[#protos+1] = {name=ID,quality=quality}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user