mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Add 2.0 support to statistics_exporter
This commit is contained in:
1 file changed
+10
-3
@@ -1,3 +1,7 @@
|
|||||||
|
local compat = require("modules/clusterio/compat")
|
||||||
|
|
||||||
|
local v2_pollution = compat.version_ge("2.0.0")
|
||||||
|
|
||||||
local statistics = {
|
local statistics = {
|
||||||
"item_production_statistics",
|
"item_production_statistics",
|
||||||
"fluid_production_statistics",
|
"fluid_production_statistics",
|
||||||
@@ -12,8 +16,11 @@ function statistics_exporter.export()
|
|||||||
player_count = #game.connected_players,
|
player_count = #game.connected_players,
|
||||||
game_flow_statistics = {
|
game_flow_statistics = {
|
||||||
pollution_statistics = {
|
pollution_statistics = {
|
||||||
input = game.pollution_statistics.input_counts,
|
--- TODO support multi surface pollution statistics
|
||||||
output = game.pollution_statistics.output_counts,
|
--- @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
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
force_flow_statistics = {}
|
force_flow_statistics = {}
|
||||||
@@ -30,5 +37,5 @@ function statistics_exporter.export()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
rcon.print(game.table_to_json(stats))
|
rcon.print(compat.table_to_json(stats))
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user