Add clusterio_statistics_exporter_platform_mapping

This allows queries to map between the platform surfaces tracked in the statistics and the name assigned by the player
This commit is contained in:
Danielv123 committed 2024-12-02 21:05:24 +00:00
1 parent 7934e471a7
commit fd741f9b49
2 files changed
+38 -1

No files matched your search

+13 -1
View File
@@ -14,7 +14,8 @@ function statistics_exporter.export()
local stats = {
game_tick = game.tick,
player_count = #game.connected_players,
surface_statistics = {}
surface_statistics = {},
platforms = {}
}
for _, surface in pairs(game.surfaces) do
@@ -43,5 +44,16 @@ function statistics_exporter.export()
stats.surface_statistics[surface.name] = surface_stats
end
if v2_stats then
for _, force in pairs(game.forces) do
for _, platform in pairs(force.platforms) do
stats.platforms[platform.name] = {
force = force.name,
surface = platform.surface.name
}
end
end
end
rcon.print(compat.table_to_json(stats))
end