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:
parent
e31971c58e
commit
e1f8198b57
24 changed files with 1524 additions and 30 deletions
|
|
@ -4,6 +4,7 @@ import dev.adamko.kafkatorio.library.LuaJsonList
|
|||
import dev.adamko.kafkatorio.schema.common.FactorioPrototype
|
||||
import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.Tick
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
|
@ -102,3 +103,30 @@ data class ResearchUpdate(
|
|||
/** The map setting that multiplies the cost of all technologies */
|
||||
val technologyPriceMultiplier: Double = 1.0,
|
||||
) : KafkatorioInstantPacketData()
|
||||
|
||||
|
||||
/**
|
||||
* How much of each item and fluid a force produced and consumed on a surface, since the previous
|
||||
* update (usually one minute).
|
||||
*/
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ProductionUpdate")
|
||||
data class ProductionUpdate(
|
||||
val forceName: String,
|
||||
val surfaceIndex: SurfaceIndex,
|
||||
/** The game tick at the end of the period */
|
||||
val tick: Tick,
|
||||
/** The length of the period, in ticks */
|
||||
val periodTicks: UInt,
|
||||
val items: ProductionCounts = ProductionCounts(),
|
||||
val fluids: ProductionCounts = ProductionCounts(),
|
||||
) : KafkatorioInstantPacketData() {
|
||||
|
||||
/** Amounts by item or fluid name. Names with no change are left out. */
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ProductionUpdate.ProductionCounts")
|
||||
data class ProductionCounts(
|
||||
val produced: Map<String, Double> = emptyMap(),
|
||||
val consumed: Map<String, Double> = emptyMap(),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue