Private
Public Access
1
0

Added Reserach Stats, still have to add power and research avg

This commit is contained in:
Jan Grießhaber
2026-01-01 16:39:34 +01:00
parent 0facba95d6
commit 9256d2d317
3 changed files with 70 additions and 5 deletions

View File

@@ -4,7 +4,6 @@ require("pollution-stats")
require("research-stats")
require("power-stats")
require("logistic-network-stats")
require("storage")
tickInterval = tonumber(settings.global["factorio-prometheus-exporter-tick-interval"].value) or 300
udpAddress = tonumber(settings.startup["factorio-prometheus-exporter-udp-address"].value) or 52555
@@ -16,6 +15,9 @@ script.on_init(function ()
storage.electricGrids = {}
storage.researchedTechnologies = {}
storage.playerDeathCount = {}
storage.totalLabCount = 0
storage.totalResearchSpeed = 0
storage.totalReseachProductivity = 0
end)
script.on_load(function ()
@@ -26,6 +28,7 @@ end)
-- Register the handler for the player movement event
script.on_event(defines.events.on_player_died, function(event)
local player = game.get_player(event.player_index)
@@ -69,14 +72,15 @@ function SendAll(event)
isInitialized = true
if (event.tick % math.floor(tickInterval/4) ~= 0) then return end
if (event.tick % math.floor(tickInterval/6) ~= 0) then return end
sendIndex = (sendIndex % 5) + 1
sendIndex = (sendIndex % 6) + 1
if sendIndex == 1 then SendProductionStats() end
if sendIndex == 2 then SendPollutionStats() end
if sendIndex == 3 then SendKillStats() end
if sendIndex == 4 then SendFluidProductionStats() end
if sendIndex == 5 then SendBuildStats() end
if sendIndex == 6 then SendResearchStats() end
if(event.tick % tickInterval*2 == 0) then SendGameStats(event) end
end