Show building rotation, recipes and other surfaces on the web map
The mod now sends each building's direction and recipe (furnaces: the last recipe, since they only have one while working). - Rotated buildings are drawn at their real footprint. - Crafting machines show their recipe icon, like Factorio's alt mode, and the hover tooltip includes the recipe. The web map has a surface drop-down (e.g. Space Exploration planets and orbits), backed by a new surfaces endpoint. Every layer, the resource labels and the player markers follow the chosen surface. Resource labels use the in-game names (e.g. "Iridite" instead of "Se iridium ore"). export_building_icons.py also exports recipe icons, plus recipe and resource names. The three in-memory views in events-server-web now share one helper for following a Kafka topic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7ef4918a5c
commit
b9adb9ea83
20 changed files with 482 additions and 139 deletions
|
|
@ -30,6 +30,10 @@ sealed interface FactorioEntityData {
|
|||
val lastUser: UInt? = null,
|
||||
val status: Status? = null,
|
||||
val unitNumber: UnitNumber? = null,
|
||||
/** @see FactorioEntityUpdateElement.Standard.direction */
|
||||
val direction: UByte? = null,
|
||||
/** @see FactorioEntityUpdateElement.Standard.recipe */
|
||||
val recipe: String? = null,
|
||||
) : FactorioEntityData
|
||||
|
||||
|
||||
|
|
@ -273,6 +277,10 @@ sealed interface FactorioEntityUpdateElement {
|
|||
val isActive: Boolean = false,
|
||||
val isRotatable: Boolean = false,
|
||||
val lastUser: UInt? = null,
|
||||
/** `defines.direction` - 0 (north) to 15, clockwise. Only set if the entity can be rotated. */
|
||||
val direction: UByte? = null,
|
||||
/** The name of the recipe that a crafting machine is set to (or last used, for furnaces) */
|
||||
val recipe: String? = null,
|
||||
) : FactorioEntityUpdateElement
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,8 @@ data class MapBuilding(
|
|||
val status: FactorioEntityData.Status? = null,
|
||||
val health: Float? = null,
|
||||
val unitNumber: UnitNumber? = null,
|
||||
/** `defines.direction` - 0 (north) to 15, clockwise */
|
||||
val direction: UByte? = null,
|
||||
/** The name of the recipe of a crafting machine */
|
||||
val recipe: String? = null,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package dev.adamko.kafkatorio.schema.common
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
/** A surface (e.g. Nauvis, or a Space Exploration planet or orbit) that has map data. */
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.surface.MapSurface")
|
||||
data class MapSurface(
|
||||
val index: SurfaceIndex,
|
||||
val name: String,
|
||||
)
|
||||
|
|
@ -174,7 +174,9 @@ data class MapChunkEntityUpdate(
|
|||
health = entity.health,
|
||||
isActive = entity.isActive,
|
||||
isRotatable = entity.isRotatable,
|
||||
lastUser = entity.lastUser
|
||||
lastUser = entity.lastUser,
|
||||
direction = entity.direction,
|
||||
recipe = entity.recipe,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue