mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 15:24:52 +09:00
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:
1 parent
7934e471a7
commit
fd741f9b49
2 files changed
+38
-1
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user