Patches after manual testing

This commit is contained in:
Cooldude2606 committed 2024-11-23 14:27:06 +00:00
1 parent ba3d74388d
commit ebf8504507
6 files changed
+114 -87

No files matched your search

@@ -1,6 +1,6 @@
local compat = require("modules/clusterio/compat")
local v2_pollution = compat.version_ge("2.0.0")
local v2_stats = compat.version_ge("2.0.0")
local statistics = {
"item_production_statistics",
@@ -11,16 +11,16 @@ local statistics = {
statistics_exporter = {}
function statistics_exporter.export()
--- @diagnostic disable-next-line undefined-field
local pollution = v2_stats and game.get_pollution_statistics(1) or game.pollution_statistics
local stats = {
game_tick = game.tick,
player_count = #game.connected_players,
game_flow_statistics = {
pollution_statistics = {
--- TODO support multi surface pollution statistics
--- @diagnostic disable undefined-field
input = v2_pollution and game.get_pollution_statistics(1).input_counts or game.pollution_statistics.input_counts,
output = v2_pollution and game.get_pollution_statistics(1).output_counts or game.pollution_statistics.output_counts,
--- @diagnostic enable undefined-field
input = pollution.input_counts,
output = pollution.output_counts,
},
},
force_flow_statistics = {}
@@ -28,9 +28,10 @@ function statistics_exporter.export()
for _, force in pairs(game.forces) do
local flow_statistics = {}
for _, statName in pairs(statistics) do
local stat = v2_stats and force["get_" .. statName](1) or force[statName]
flow_statistics[statName] = {
input = force[statName].input_counts,
output = force[statName].output_counts,
input = stat.input_counts,
output = stat.output_counts,
}
end
stats.force_flow_statistics[force.name] = flow_statistics