Add a research page, and keep the topics that views are rebuilt from

The mod sends the research state of a force (researched technologies,
levels, current research, progress and queue) whenever research changes,
and every minute for the progress. events-server-web keeps the latest state
and serves it at /kafkatorio/data/servers/{id}/research.

The web map has a research page (/servers/{id}/research, linked from the
header), with:
- progress, the current research and the queue
- the science packs needed for everything that's left
- every technology, filterable by status, science pack and name, with its
  cost (including levelled technologies' count formulas)
- details: the total cost to reach a technology, its prerequisites, what it
  leads to and what it unlocks

The technology tree comes from export_building_icons.py, which now also
exports technologies.json, items.json and technology/science pack icons.

Kafka deleted data older than 7 days, but the building, resource and
research views are rebuilt by reading their topics from the beginning, so
buildings disappeared after a restart. These topics are now kept forever.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lazzexus 2026-11-03 10:46:09 +01:00
parent 4d02928081
commit e31971c58e
23 changed files with 1517 additions and 11 deletions

View file

@ -79,3 +79,26 @@ data class SurfaceUpdate(
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/** The research state of a force: what's researched, and what's being researched. */
@Serializable
@SerialName("kafkatorio.packet.instant.ResearchUpdate")
data class ResearchUpdate(
val forceName: String,
/** The names of all researched technologies */
val researched: LuaJsonList<String>,
/**
* The level of technologies that can be researched more than once (e.g. infinite mining
* productivity). The level is the next one to research.
*/
val levels: Map<String, Int> = emptyMap(),
/** The technology that's being researched */
val current: String? = null,
/** Progress of [current], from 0 to 1 */
val progress: Double? = null,
/** The research queue, starting with [current] */
val queue: LuaJsonList<String> = LuaJsonList(emptyList()),
/** The map setting that multiplies the cost of all technologies */
val technologyPriceMultiplier: Double = 1.0,
) : KafkatorioInstantPacketData()