Add a production dashboard

Every minute, the mod diffs the force's production statistics for each
surface against the totals it sent last time (kept in
storage.productionTotals), and sends what was produced and consumed as a
ProductionUpdate.

events-server-web keeps the statistics in ring buffers (1440 minutes and
168 hours), and serves them at
/kafkatorio/data/servers/{id}/production, for a range of game time and
optionally one surface.

The web map has a production page (/servers/{id}/production, linked from
the header) with science packs used per minute (in total and per pack),
production per minute as a line chart, and a searchable table of
everything produced and consumed.

export_building_icons.py now also exports every item and fluid icon and
name (items.json, fluids.json), for the production page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-11-22 10:26:16 +01:00
parent e31971c58e
commit e1f8198b57
24 changed files with 1524 additions and 30 deletions

View file

@ -10,6 +10,7 @@ import dev.adamko.kafkatorio.schema.packets.MapChunkEntityUpdate
import dev.adamko.kafkatorio.schema.packets.MapChunkResourceUpdate
import dev.adamko.kafkatorio.schema.packets.MapChunkTileUpdate
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
import dev.adamko.kafkatorio.schema.packets.ProductionUpdate
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
import dev.adamko.kafkatorio.schema.packets.ResearchUpdate
import dev.adamko.kafkatorio.schema.packets.SurfaceUpdate
@ -77,6 +78,7 @@ val KafkatorioPacketData.topicName: String
is MapChunkEntityUpdate -> packetTopicNames.getValue(MapChunkEntityUpdate::class)
is MapChunkResourceUpdate -> packetTopicNames.getValue(MapChunkResourceUpdate::class)
is ResearchUpdate -> packetTopicNames.getValue(ResearchUpdate::class)
is ProductionUpdate -> packetTopicNames.getValue(ProductionUpdate::class)
}
@ -93,6 +95,7 @@ private val packetTopicNames: Map<KClass<out KafkatorioPacketData>, String> = ma
MapChunkResourceUpdate::class to "map-chunk-resource",
KafkatorioPacketDataError::class to "error",
ResearchUpdate::class to "research",
ProductionUpdate::class to "production",
).mapValues { (_, v) ->
"$DOMAIN.packet.$v"
}