emit entity prototypes

- mod: refactor event handlers to separate files
- lib: update models for prototypes
This commit is contained in:
Adam 2022-07-08 21:06:09 +02:00
parent 4510ec4a6e
commit 80eb001bbf
27 changed files with 1570 additions and 1437 deletions

View file

@ -8,15 +8,16 @@ import kotlinx.serialization.Serializable
@Serializable
@SerialName("kafkatorio.prototype.FactorioPrototype")
sealed interface FactorioPrototype {
val protoId: PrototypeId
val mapColour: Colour
@SerialName("kafkatorio.prototype.MapTile")
@Serializable
data class MapTile(
override val protoId: PrototypeId,
override val mapColour: Colour,
val mapColour: Colour,
val layer: UInt,
@Contextual
@ -27,27 +28,47 @@ sealed interface FactorioPrototype {
) : FactorioPrototype
/**
* @param[colour] The colour of the prototype, or `null` if the prototype doesn't have colour.
* @param[mapColour] The map colour used when charting this entity if a
* [friendly][mapColourFriend] or [enemy][mapColourEnemy] colour isn't defined or `null`.
* @param[mapColourFriend] The friendly map colour used when charting this entity.
* @param[mapColourEnemy] The enemy map colour used when charting this entity.
*/
@SerialName("kafkatorio.prototype.Entity")
@Serializable
data class Entity(
override val protoId: PrototypeId,
override val mapColour: Colour,
val protoType: String,
val objectName: String,
val colour: Colour,
val group: ItemGroup,
val subgroup: ItemGroup,
val colour: Colour? = null,
val mapColour: Colour? = null,
val mapColourFriend: Colour? = null,
val mapColourEnemy: Colour? = null,
val maxHealth: Float,
val isBuilding: Boolean,
val isEntityWithOwner: Boolean,
val isMilitaryTarget: Boolean,
val miningProperties: MiningProperties
val miningProperties: MiningProperties? = null,
) : FactorioPrototype {
@Serializable
@SerialName("kafkatorio.prototype.EntityMiningProperties")
data class MiningProperties(
val canBeMined: Boolean,
val products: List<MinedProduct>?,
)
@Serializable
@SerialName("kafkatorio.prototype.EntityItemGroup")
data class ItemGroup(
val name: String,
val type: String,
val parentName: String? = null,
)
}
}