- add tile deconstruction (concrete tiles can be removed)
- add @SerialName to all packets - start implementing Entity prototype - start implementing Entity updates - clean up some old commented out code - refactor how debounced events track the triggering events (now include timestamps per event) - bump tstl
This commit is contained in:
parent
5656acd350
commit
688b2c7bcb
30 changed files with 650 additions and 553 deletions
|
|
@ -2,6 +2,7 @@ package dev.adamko.kafkatorio.schema.common
|
|||
|
||||
import dev.adamko.kxstsgen.core.experiments.TupleSerializer
|
||||
import kotlin.math.roundToInt
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
|
|
@ -11,6 +12,7 @@ import kotlinx.serialization.Serializable
|
|||
* All values here are optional. Colour channels default to `0`, the alpha channel defaults to `1`.
|
||||
*/
|
||||
@Serializable(with = Colour.Serializer::class)
|
||||
@SerialName("kafkatorio.common.Colour")
|
||||
data class Colour(
|
||||
val red: Float = 0f,
|
||||
val green: Float = 0f,
|
||||
|
|
@ -40,6 +42,7 @@ data class Colour(
|
|||
|
||||
/** Size-efficient version of [Colour] (`4*4` bytes vs `4*1` bytes) */
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.common.ColourHex")
|
||||
data class ColourHex(
|
||||
val red: UByte = UByte.MIN_VALUE,
|
||||
val green: UByte = UByte.MIN_VALUE,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import kotlinx.serialization.Serializable
|
|||
@JvmInline
|
||||
value class Tick(val value: UInt)
|
||||
|
||||
val UInt.tick
|
||||
get() = Tick(this)
|
||||
|
||||
/**
|
||||
* Unique ID associated with this surface
|
||||
|
|
@ -51,6 +53,13 @@ value class PrototypeName(private val id: String) {
|
|||
}
|
||||
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class EventName(private val name: String) {
|
||||
override fun toString(): String = name
|
||||
}
|
||||
|
||||
|
||||
interface EntityIdentifiers {
|
||||
val unitNumber: UnitNumber?
|
||||
val name: String
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package dev.adamko.kafkatorio.schema.common
|
||||
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.prototype.FactorioPrototype")
|
||||
sealed interface FactorioPrototype {
|
||||
val name: PrototypeName
|
||||
val mapColour: Colour
|
||||
|
||||
@SerialName("kafkatorio.prototype.MapTile")
|
||||
@Serializable
|
||||
data class MapTile(
|
||||
override val name: PrototypeName,
|
||||
override val mapColour: Colour,
|
||||
|
||||
val layer: UInt,
|
||||
@Contextual
|
||||
val collisionMasks: List<String>,
|
||||
val order: String,
|
||||
/** Can the tile be mined for resources? */
|
||||
val canBeMined: Boolean,
|
||||
) : FactorioPrototype
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package dev.adamko.kafkatorio.schema.common
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Serializable
|
||||
data class MinedProduct(
|
||||
/** `item` or `fluid`. */
|
||||
val type: Type,
|
||||
|
||||
/** Prototype name of the result. */
|
||||
@SerialName("name")
|
||||
val resultPrototype: PrototypeName,
|
||||
|
||||
//Amount of the item or fluid to give. If not specified, amount_min, amount_max and probability must all be specified.
|
||||
val amount: Double?,
|
||||
|
||||
//Minimal amount of the item or fluid to give. Has no effect when amount is specified.
|
||||
//amount_min : Uint or double?,
|
||||
|
||||
//Maximum amount of the item or fluid to give. Has no effect when amount is specified.
|
||||
//amount_max : Uint or double?,
|
||||
|
||||
//A value in range [0, 1]. Item or fluid is only given with this probability; otherwise no product is produced.
|
||||
//probability : Double?,
|
||||
|
||||
//How much of this product is a catalyst.
|
||||
//catalyst_amount : Uint or double?,
|
||||
) {
|
||||
|
||||
@Serializable
|
||||
enum class Type {
|
||||
@SerialName("item")
|
||||
ITEM,
|
||||
@SerialName("fluid")
|
||||
FLUID,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package dev.adamko.kafkatorio.schema.packets
|
||||
|
||||
import dev.adamko.kafkatorio.schema.common.Tick
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.KafkatorioPacket")
|
||||
data class KafkatorioPacket(
|
||||
val modVersion: String,
|
||||
val tick: Tick,
|
||||
|
|
@ -13,4 +15,5 @@ data class KafkatorioPacket(
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.KafkatorioPacketData")
|
||||
sealed class KafkatorioPacketData
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
package dev.adamko.kafkatorio.schema.packets
|
||||
|
||||
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.prototypes.FactorioPrototype
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
/** No key, no caching. Must be sent instantly. */
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.KafkatorioPacket")
|
||||
sealed class KafkatorioInstantPacketData : KafkatorioPacketData()
|
||||
|
||||
|
||||
|
|
@ -15,6 +17,7 @@ sealed class KafkatorioInstantPacketData : KafkatorioPacketData()
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ConfigurationUpdate")
|
||||
data class ConfigurationUpdate(
|
||||
val factorioData: ConfigurationUpdateGameData,
|
||||
val allMods: List<ConfigurationUpdateModData>,
|
||||
|
|
@ -23,12 +26,14 @@ data class ConfigurationUpdate(
|
|||
) : KafkatorioInstantPacketData() {
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ConfigurationUpdate.ConfigurationUpdateGameData")
|
||||
data class ConfigurationUpdateGameData(
|
||||
val oldVersion: String? = null,
|
||||
val newVersion: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ConfigurationUpdate.ConfigurationUpdateModData")
|
||||
data class ConfigurationUpdateModData(
|
||||
val modName: String,
|
||||
val currentVersion: String? = null,
|
||||
|
|
@ -38,6 +43,7 @@ data class ConfigurationUpdate(
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ConsoleChatUpdate")
|
||||
data class ConsoleChatUpdate(
|
||||
val authorPlayerIndex: PlayerIndex?,
|
||||
val content: String,
|
||||
|
|
@ -45,6 +51,7 @@ data class ConsoleChatUpdate(
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.ConsoleCommandUpdate")
|
||||
data class ConsoleCommandUpdate(
|
||||
val authorPlayerIndex: PlayerIndex?,
|
||||
val command: String,
|
||||
|
|
@ -53,12 +60,14 @@ data class ConsoleCommandUpdate(
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.PrototypesUpdate")
|
||||
data class PrototypesUpdate(
|
||||
val prototypes: List<FactorioPrototype>,
|
||||
) : KafkatorioInstantPacketData()
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.instant.SurfaceUpdate")
|
||||
data class SurfaceUpdate(
|
||||
val index: SurfaceIndex,
|
||||
val daytime: Double,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package dev.adamko.kafkatorio.schema.packets
|
|||
import dev.adamko.kafkatorio.schema.common.Colour
|
||||
import dev.adamko.kafkatorio.schema.common.EntityIdentifiers
|
||||
import dev.adamko.kafkatorio.schema.common.EntityIdentifiersData
|
||||
import dev.adamko.kafkatorio.schema.common.EventName
|
||||
import dev.adamko.kafkatorio.schema.common.ForceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.MapChunkPosition
|
||||
import dev.adamko.kafkatorio.schema.common.MapEntityPosition
|
||||
|
|
@ -12,40 +13,46 @@ import dev.adamko.kafkatorio.schema.common.PrototypeName
|
|||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.Tick
|
||||
import dev.adamko.kafkatorio.schema.common.UnitNumber
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
/** Has a key, so it can be debounced */
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.KafkatorioKeyedPacketData")
|
||||
sealed class KafkatorioKeyedPacketData : KafkatorioPacketData() {
|
||||
/** Count how many events this packet is aggregating data from */
|
||||
abstract val key: KafkatorioKeyedPacketKey2
|
||||
abstract val eventCounts: Map<String, UInt>?
|
||||
abstract val key: KafkatorioKeyedPacketKey
|
||||
/** A list of all events that have been aggregated into this packet. */
|
||||
abstract val events: Map<EventName, List<Tick>>?
|
||||
}
|
||||
|
||||
|
||||
@Serializable
|
||||
sealed class KafkatorioKeyedPacketKey2
|
||||
@SerialName("kafkatorio.packet.keyed.KafkatorioKeyedPacketKey")
|
||||
sealed class KafkatorioKeyedPacketKey
|
||||
|
||||
|
||||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.EntityUpdateKey")
|
||||
data class EntityUpdateKey(
|
||||
/** While normally optional, here a [unitNumber] is required for caching */
|
||||
override val unitNumber: UnitNumber,
|
||||
override val name: String,
|
||||
override val protoType: String,
|
||||
) : EntityIdentifiers, KafkatorioKeyedPacketKey2()
|
||||
) : EntityIdentifiers, KafkatorioKeyedPacketKey()
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.EntityUpdate")
|
||||
data class EntityUpdate(
|
||||
override val key: EntityUpdateKey,
|
||||
|
||||
override val eventCounts: Map<String, UInt>? = null,
|
||||
override val events: Map<EventName, List<Tick>>? = null,
|
||||
|
||||
val chunkPosition: MapChunkPosition? = null,
|
||||
val chunkPosition: MapEntityPosition? = null,
|
||||
val graphicsVariation: UByte? = null,
|
||||
val health: Float? = null,
|
||||
val isActive: Boolean? = null,
|
||||
|
|
@ -61,17 +68,19 @@ data class EntityUpdate(
|
|||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.MapChunkUpdateKey")
|
||||
data class MapChunkUpdateKey(
|
||||
val chunkPosition: MapChunkPosition,
|
||||
val surfaceIndex: SurfaceIndex,
|
||||
) : KafkatorioKeyedPacketKey2()
|
||||
) : KafkatorioKeyedPacketKey()
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.MapChunkUpdate")
|
||||
data class MapChunkUpdate(
|
||||
override val key: MapChunkUpdateKey,
|
||||
|
||||
override val eventCounts: Map<String, UInt>? = null,
|
||||
override val events: Map<EventName, List<Tick>>? = null,
|
||||
|
||||
val player: PlayerIndex? = null,
|
||||
val robot: EntityIdentifiersData? = null,
|
||||
|
|
@ -85,16 +94,18 @@ data class MapChunkUpdate(
|
|||
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.PlayerUpdateKey")
|
||||
data class PlayerUpdateKey(
|
||||
val index: PlayerIndex,
|
||||
) : KafkatorioKeyedPacketKey2()
|
||||
) : KafkatorioKeyedPacketKey()
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("kafkatorio.packet.keyed.PlayerUpdate")
|
||||
data class PlayerUpdate(
|
||||
override val key: PlayerUpdateKey,
|
||||
|
||||
override val eventCounts: Map<String, UInt>? = null,
|
||||
override val events: Map<EventName, List<Tick>>? = null,
|
||||
|
||||
val characterUnitNumber: UnitNumber? = null,
|
||||
val chatColour: Colour? = null,
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
package dev.adamko.kafkatorio.schema.prototypes
|
||||
|
||||
import dev.adamko.kafkatorio.schema.common.Colour
|
||||
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||
import kotlinx.serialization.Contextual
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@Serializable
|
||||
sealed class FactorioPrototype {
|
||||
|
||||
@Serializable
|
||||
data class MapTile(
|
||||
val name: PrototypeName,
|
||||
val layer: UInt,
|
||||
val mapColour: Colour,
|
||||
@Contextual
|
||||
val collisionMasks: List<String>,
|
||||
val order: String,
|
||||
/** Can the tile be mined for resources? */
|
||||
val canBeMined: Boolean,
|
||||
) : FactorioPrototype()
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
package dev.adamko.kafkatorio.events.schema
|
||||
|
||||
import dev.adamko.kafkatorio.schema.common.EventName
|
||||
import dev.adamko.kafkatorio.schema.common.MapChunkPosition
|
||||
import dev.adamko.kafkatorio.schema.common.MapTileDictionary
|
||||
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.Tick
|
||||
import dev.adamko.kafkatorio.schema.common.tick
|
||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||
import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate
|
||||
|
|
@ -20,7 +21,7 @@ class MapChunkUpdateTest : FunSpec({
|
|||
val json = """
|
||||
{
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.MapChunkUpdate",
|
||||
"type": "kafkatorio.packet.keyed.MapChunkUpdate",
|
||||
"key": {
|
||||
"surfaceIndex": 1,
|
||||
"chunkPosition": [
|
||||
|
|
@ -46,8 +47,8 @@ class MapChunkUpdateTest : FunSpec({
|
|||
"grass-3": 32
|
||||
}
|
||||
},
|
||||
"eventCounts": {
|
||||
"on_chunk_generated": 1
|
||||
"events": {
|
||||
"on_chunk_generated": [1]
|
||||
}
|
||||
},
|
||||
"modVersion": "0.4.0",
|
||||
|
|
@ -56,14 +57,16 @@ class MapChunkUpdateTest : FunSpec({
|
|||
""".trimIndent()
|
||||
|
||||
val expected = KafkatorioPacket(
|
||||
tick = Tick(36u),
|
||||
tick = 36u.tick,
|
||||
modVersion = "0.4.0",
|
||||
data = MapChunkUpdate(
|
||||
key = MapChunkUpdateKey(
|
||||
MapChunkPosition(-6, -3),
|
||||
SurfaceIndex(1u),
|
||||
),
|
||||
eventCounts = mapOf("on_chunk_generated" to 1u),
|
||||
events = mapOf(
|
||||
EventName("on_chunk_generated") to listOf(1u.tick)
|
||||
),
|
||||
tileDictionary = MapTileDictionary(
|
||||
tilesXY = mapOf(
|
||||
"-192" to mapOf("-65" to MapTileDictionary.PrototypeKey(2)),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package dev.adamko.kafkatorio.events.schema
|
||||
|
||||
import dev.adamko.kafkatorio.schema.common.Colour
|
||||
import dev.adamko.kafkatorio.schema.common.FactorioPrototype
|
||||
import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||
import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||
import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate
|
||||
import io.kotest.core.spec.style.BehaviorSpec
|
||||
|
|
@ -20,10 +20,10 @@ class PrototypesTest : BehaviorSpec({
|
|||
"modVersion": "0.2.4",
|
||||
"tick": 534,
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.PrototypesUpdate",
|
||||
"type": "kafkatorio.packet.instant.PrototypesUpdate",
|
||||
"prototypes": [
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "tile-unknown",
|
||||
"order": "z-a",
|
||||
"layer": 0,
|
||||
|
|
@ -50,10 +50,10 @@ class PrototypesTest : BehaviorSpec({
|
|||
"modVersion": "0.3.2",
|
||||
"tick": 534,
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.PrototypesUpdate",
|
||||
"type": "kafkatorio.packet.instant.PrototypesUpdate",
|
||||
"prototypes": [
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "stone-path",
|
||||
"order": "a[artificial]-a[tier-1]-a[stone-path]",
|
||||
"layer": 60,
|
||||
|
|
@ -64,7 +64,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "concrete",
|
||||
"order": "a[artificial]-b[tier-2]-a[concrete]",
|
||||
"layer": 61,
|
||||
|
|
@ -75,7 +75,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "hazard-concrete-left",
|
||||
"order": "a[artificial]-b[tier-2]-b[hazard-concrete-left]",
|
||||
"layer": 62,
|
||||
|
|
@ -86,7 +86,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "hazard-concrete-right",
|
||||
"order": "a[artificial]-b[tier-2]-c[hazard-concrete-right]",
|
||||
"layer": 62,
|
||||
|
|
@ -97,7 +97,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "refined-concrete",
|
||||
"order": "a[artificial]-c[tier-3]-a[refined-concrete]",
|
||||
"layer": 64,
|
||||
|
|
@ -108,7 +108,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "refined-hazard-concrete-left",
|
||||
"order": "a[artificial]-c[tier-3]-b[refined-hazard-concrete-left]",
|
||||
"layer": 65,
|
||||
|
|
@ -119,7 +119,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "refined-hazard-concrete-right",
|
||||
"order": "a[artificial]-c[tier-3]-c[refined-hazard-concrete-right]",
|
||||
"layer": 65,
|
||||
|
|
@ -130,7 +130,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": true
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "landfill",
|
||||
"order": "a[artificial]-d[utility]-a[landfill]",
|
||||
"layer": 57,
|
||||
|
|
@ -141,7 +141,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "acid-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-acid",
|
||||
"layer": 97,
|
||||
|
|
@ -152,7 +152,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "black-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-black",
|
||||
"layer": 88,
|
||||
|
|
@ -163,7 +163,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "blue-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-blue",
|
||||
"layer": 73,
|
||||
|
|
@ -174,7 +174,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "brown-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-brown",
|
||||
"layer": 91,
|
||||
|
|
@ -185,7 +185,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "cyan-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-cyan",
|
||||
"layer": 94,
|
||||
|
|
@ -196,7 +196,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "green-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-green",
|
||||
"layer": 70,
|
||||
|
|
@ -207,7 +207,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "orange-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-orange",
|
||||
"layer": 76,
|
||||
|
|
@ -218,7 +218,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "pink-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-pink",
|
||||
"layer": 82,
|
||||
|
|
@ -229,7 +229,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "purple-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-purple",
|
||||
"layer": 85,
|
||||
|
|
@ -240,7 +240,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "red-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-red",
|
||||
"layer": 67,
|
||||
|
|
@ -251,7 +251,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "yellow-refined-concrete",
|
||||
"order": "a[artificial]-e[color-concrete]-yellow",
|
||||
"layer": 79,
|
||||
|
|
@ -262,7 +262,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "grass-1",
|
||||
"order": "b[natural]-a[grass]-a[grass-1]",
|
||||
"layer": 26,
|
||||
|
|
@ -273,7 +273,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "grass-2",
|
||||
"order": "b[natural]-a[grass]-b[grass-2]",
|
||||
"layer": 28,
|
||||
|
|
@ -284,7 +284,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "grass-3",
|
||||
"order": "b[natural]-a[grass]-c[grass-3]",
|
||||
"layer": 29,
|
||||
|
|
@ -295,7 +295,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "grass-4",
|
||||
"order": "b[natural]-a[grass]-d[grass-4]",
|
||||
"layer": 30,
|
||||
|
|
@ -306,7 +306,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dry-dirt",
|
||||
"order": "b[natural]-b[dirt]-a[dry-dirt]",
|
||||
"layer": 18,
|
||||
|
|
@ -317,7 +317,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-1",
|
||||
"order": "b[natural]-b[dirt]-b[dirt-1]",
|
||||
"layer": 19,
|
||||
|
|
@ -328,7 +328,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-2",
|
||||
"order": "b[natural]-b[dirt]-c[dirt-2]",
|
||||
"layer": 20,
|
||||
|
|
@ -339,7 +339,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-3",
|
||||
"order": "b[natural]-b[dirt]-d[dirt-3]",
|
||||
"layer": 21,
|
||||
|
|
@ -350,7 +350,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-4",
|
||||
"order": "b[natural]-b[dirt]-e[dirt-4]",
|
||||
"layer": 22,
|
||||
|
|
@ -361,7 +361,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-5",
|
||||
"order": "b[natural]-b[dirt]-f[dirt-5]",
|
||||
"layer": 23,
|
||||
|
|
@ -372,7 +372,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-6",
|
||||
"order": "b[natural]-b[dirt]-g[dirt-6]",
|
||||
"layer": 24,
|
||||
|
|
@ -383,7 +383,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "dirt-7",
|
||||
"order": "b[natural]-b[dirt]-h[dirt-7]",
|
||||
"layer": 25,
|
||||
|
|
@ -394,7 +394,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "sand-1",
|
||||
"order": "b[natural]-c[sand]-a[sand-1]",
|
||||
"layer": 8,
|
||||
|
|
@ -405,7 +405,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "sand-2",
|
||||
"order": "b[natural]-c[sand]-b[sand-2]",
|
||||
"layer": 9,
|
||||
|
|
@ -416,7 +416,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "sand-3",
|
||||
"order": "b[natural]-c[sand]-c[sand-3]",
|
||||
"layer": 10,
|
||||
|
|
@ -427,7 +427,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "red-desert-0",
|
||||
"order": "b[natural]-d[red-desert]-a[red-desert-0]",
|
||||
"layer": 31,
|
||||
|
|
@ -438,7 +438,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "red-desert-1",
|
||||
"order": "b[natural]-d[red-desert]-b[red-desert-1]",
|
||||
"layer": 14,
|
||||
|
|
@ -449,7 +449,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "red-desert-2",
|
||||
"order": "b[natural]-d[red-desert]-c[red-desert-2]",
|
||||
"layer": 15,
|
||||
|
|
@ -460,7 +460,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "red-desert-3",
|
||||
"order": "b[natural]-d[red-desert]-d[red-desert-3]",
|
||||
"layer": 16,
|
||||
|
|
@ -471,7 +471,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "water",
|
||||
"order": "c[water]-a[water]",
|
||||
"layer": 3,
|
||||
|
|
@ -486,7 +486,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "deepwater",
|
||||
"order": "c[water]-b[deep-water]",
|
||||
"layer": 3,
|
||||
|
|
@ -501,7 +501,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "water-green",
|
||||
"order": "c[water]-c[water-green]",
|
||||
"layer": 3,
|
||||
|
|
@ -516,7 +516,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "deepwater-green",
|
||||
"order": "c[water]-d[deepwater-green]",
|
||||
"layer": 3,
|
||||
|
|
@ -531,7 +531,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "water-shallow",
|
||||
"order": "c[water]-e[water-shallow]",
|
||||
"layer": 6,
|
||||
|
|
@ -545,7 +545,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "water-mud",
|
||||
"order": "c[water]-g[water-mud]",
|
||||
"layer": 7,
|
||||
|
|
@ -559,7 +559,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "nuclear-ground",
|
||||
"order": "d[destruction]-a[nuclear]-a[nuclear-ground]",
|
||||
"layer": 33,
|
||||
|
|
@ -570,7 +570,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "water-wube",
|
||||
"order": "x[wube]-a[water-wube]",
|
||||
"layer": 2,
|
||||
|
|
@ -585,7 +585,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "tile-unknown",
|
||||
"order": "z-a",
|
||||
"layer": 0,
|
||||
|
|
@ -595,7 +595,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "out-of-map",
|
||||
"order": "z[other]-a[out-of-map]",
|
||||
"layer": 0,
|
||||
|
|
@ -613,7 +613,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "lab-dark-1",
|
||||
"order": "z[other]-b[lab]-a[lab-dark-1]",
|
||||
"layer": 70,
|
||||
|
|
@ -624,7 +624,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "lab-dark-2",
|
||||
"order": "z[other]-b[lab]-b[lab-dark-2]",
|
||||
"layer": 70,
|
||||
|
|
@ -635,7 +635,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "lab-white",
|
||||
"order": "z[other]-b[lab]-c[lab-white]",
|
||||
"layer": 70,
|
||||
|
|
@ -646,7 +646,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
"canBeMined": false
|
||||
},
|
||||
{
|
||||
"type": "dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.MapTile",
|
||||
"type": "kafkatorio.prototype.MapTile",
|
||||
"name": "tutorial-grid",
|
||||
"order": "z[other]-c[tutorial]-a[tutorial-grid]",
|
||||
"layer": 55,
|
||||
|
|
|
|||
|
|
@ -2,13 +2,16 @@ package dev.adamko.kafkatorio.events.schema
|
|||
|
||||
import dev.adamko.kafkatorio.schema.common.Colour
|
||||
import dev.adamko.kafkatorio.schema.common.EntityIdentifiersData
|
||||
import dev.adamko.kafkatorio.schema.common.EventName
|
||||
import dev.adamko.kafkatorio.schema.common.ForceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.MapEntityPosition
|
||||
import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||
import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||
import dev.adamko.kafkatorio.schema.common.Tick
|
||||
import dev.adamko.kafkatorio.schema.common.UnitNumber
|
||||
import dev.adamko.kafkatorio.schema.common.tick
|
||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||
import dev.adamko.kafkatorio.schema.packets.KafkatorioKeyedPacketData
|
||||
import dev.adamko.kafkatorio.schema.packets.KafkatorioPacket
|
||||
import dev.adamko.kafkatorio.schema.packets.PlayerUpdate
|
||||
import dev.adamko.kafkatorio.schema.packets.PlayerUpdateKey
|
||||
|
|
@ -27,14 +30,14 @@ class UpdatePacketsTest : FunSpec({
|
|||
"tick": 66,
|
||||
"modVersion": "0.3.2",
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||
"type": "kafkatorio.packet.keyed.PlayerUpdate",
|
||||
"key": {"index": 1},
|
||||
"afkTime": 0,
|
||||
"chatColour": [1, 0.4, 0.6, 1],
|
||||
"colour": [0.8, 0.5, 0.2, 0.5],
|
||||
"eventCounts": {
|
||||
"on_player_changed_position": 7,
|
||||
"on_player_joined_game": 1
|
||||
"events": {
|
||||
"on_player_changed_position": [7, 99],
|
||||
"on_player_joined_game": [14]
|
||||
},
|
||||
"forceIndex": 1,
|
||||
"isAdmin": true,
|
||||
|
|
@ -68,7 +71,10 @@ class UpdatePacketsTest : FunSpec({
|
|||
colour = Colour(red = 0.8f, green = 0.5f, blue = 0.2f, alpha = 0.5f),
|
||||
diedCause = null,
|
||||
disconnectReason = null,
|
||||
eventCounts = mapOf("on_player_changed_position" to 7u, "on_player_joined_game" to 1u),
|
||||
events = mapOf(
|
||||
EventName("on_player_changed_position") to listOf(7u.tick, 99u.tick),
|
||||
EventName("on_player_joined_game") to listOf(14u.tick),
|
||||
),
|
||||
forceIndex = ForceIndex(1u),
|
||||
isAdmin = true,
|
||||
isConnected = true,
|
||||
|
|
@ -124,7 +130,7 @@ class UpdatePacketsTest : FunSpec({
|
|||
"modVersion": "0.3.2",
|
||||
"tick": 66,
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||
"type": "kafkatorio.packet.keyed.PlayerUpdate",
|
||||
"key": {
|
||||
"index": 1
|
||||
},
|
||||
|
|
@ -151,7 +157,7 @@ class UpdatePacketsTest : FunSpec({
|
|||
"tick": 227934,
|
||||
"modVersion": "0.3.2",
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.PlayerUpdate",
|
||||
"type": "kafkatorio.packet.keyed.PlayerUpdate",
|
||||
"key": {
|
||||
"index": 1
|
||||
},
|
||||
|
|
@ -164,8 +170,8 @@ class UpdatePacketsTest : FunSpec({
|
|||
"name": "small-biter",
|
||||
"protoType": "unit"
|
||||
},
|
||||
"eventCounts": {
|
||||
"on_player_died": 2
|
||||
"events": {
|
||||
"on_player_died": [2]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -176,9 +182,9 @@ class UpdatePacketsTest : FunSpec({
|
|||
|
||||
packet shouldBe KafkatorioPacket(
|
||||
modVersion = "0.3.2",
|
||||
tick = Tick(227934u),
|
||||
tick = 227934u.tick,
|
||||
data = PlayerUpdate(
|
||||
afkTime = Tick(324u),
|
||||
afkTime = 324u.tick,
|
||||
bannedReason = null,
|
||||
characterUnitNumber = null,
|
||||
chatColour = null,
|
||||
|
|
@ -189,7 +195,9 @@ class UpdatePacketsTest : FunSpec({
|
|||
protoType = "unit",
|
||||
),
|
||||
disconnectReason = null,
|
||||
eventCounts = mapOf("on_player_died" to 2u),
|
||||
events = mapOf(
|
||||
EventName("on_player_died") to listOf(2u.tick),
|
||||
),
|
||||
forceIndex = null,
|
||||
key = PlayerUpdateKey(PlayerIndex(1u)),
|
||||
isAdmin = null,
|
||||
|
|
@ -198,9 +206,9 @@ class UpdatePacketsTest : FunSpec({
|
|||
isShowOnMap = null,
|
||||
isSpectator = null,
|
||||
kickedReason = null,
|
||||
lastOnline = Tick(227932u),
|
||||
lastOnline = 227932u.tick,
|
||||
name = null,
|
||||
onlineTime = Tick(227888u),
|
||||
onlineTime = 227888u.tick,
|
||||
position = null,
|
||||
surfaceIndex = null,
|
||||
tag = null,
|
||||
|
|
@ -215,7 +223,7 @@ class UpdatePacketsTest : FunSpec({
|
|||
val json = """
|
||||
{
|
||||
"data": {
|
||||
"type": "dev.adamko.kafkatorio.schema.packets.SurfaceUpdate",
|
||||
"type": "kafkatorio.packet.instant.SurfaceUpdate",
|
||||
"name": "nauvis",
|
||||
"index": 1,
|
||||
"daytime": 0.73
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package dev.adamko.kafkatorio.schema.packets
|
||||
|
||||
import dev.adamko.kafkatorio.schema.jsonMapperKafkatorio
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.types.shouldBeInstanceOf
|
||||
import kotlinx.serialization.decodeFromString
|
||||
|
||||
class EntityUpdateTest : FunSpec({
|
||||
|
||||
context("EntityUpdate packet") {
|
||||
/*language=json*/
|
||||
val json = """
|
||||
{
|
||||
"data": {
|
||||
"type": "kafkatorio.packet.keyed.EntityUpdate",
|
||||
"key": {
|
||||
"name": "assembling-machine-2",
|
||||
"protoType": "assembling-machine-2",
|
||||
"unitNumber": 4622
|
||||
},
|
||||
"events": {
|
||||
"on_built_entity": [
|
||||
38023
|
||||
]
|
||||
},
|
||||
"chunkPosition": [
|
||||
-13.5,
|
||||
4.5
|
||||
],
|
||||
"health": 350,
|
||||
"isActive": true,
|
||||
"isRotatable": true,
|
||||
"lastUser": 1,
|
||||
"prototype": "assembling-machine-2"
|
||||
},
|
||||
"modVersion": "0.4.0",
|
||||
"tick": 38388
|
||||
}
|
||||
""".trimIndent()
|
||||
test("decode") {
|
||||
val entityUpdate: KafkatorioPacket = jsonMapperKafkatorio.decodeFromString(json)
|
||||
entityUpdate.data
|
||||
.shouldBeInstanceOf<EntityUpdate>()
|
||||
|
||||
// entityUpdate.health.shouldNotBeNull().shouldBeExactly(350f)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue