- tidy up groupMapChunks.kt
- add ticks to all Kafkatorio Packets - add Kafka Streams test for groupMapChunks.kt
This commit is contained in:
parent
bfdee32d61
commit
b8ba8b7c9e
22 changed files with 271 additions and 98 deletions
|
|
@ -112,8 +112,9 @@ interface EntityIdentifiers {
|
|||
data class MapTileDictionary(
|
||||
/** Map an X,Y coordinate a prototype name */
|
||||
val tilesXY: Map<String, Map<String, PrototypeKey>>,
|
||||
val protos: Map<PrototypeKey, PrototypeName>
|
||||
val protos: Map<PrototypeKey, PrototypeName>,
|
||||
) {
|
||||
|
||||
fun toMapTileList(): List<MapTile> = buildList {
|
||||
tilesXY.forEach { (xString, row) ->
|
||||
row.forEach { (yString, protoIndex) ->
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import kotlinx.serialization.Serializable
|
|||
@Serializable
|
||||
data class FactorioConfigurationUpdate(
|
||||
override val modVersion: String,
|
||||
override val tick: Tick,
|
||||
val factorioData: FactorioGameDataUpdate,
|
||||
val allMods: List<FactorioModInfo>,
|
||||
) : KafkatorioPacket() {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||
@Serializable
|
||||
data class FactorioEventUpdatePacket(
|
||||
override val modVersion: String,
|
||||
/** game time */
|
||||
val tick: Tick,
|
||||
override val tick: Tick,
|
||||
val update: FactorioEventUpdate,
|
||||
) : KafkatorioPacket() {
|
||||
@EncodeDefault
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ import kotlinx.serialization.Serializable
|
|||
@Serializable
|
||||
data class FactorioEvent(
|
||||
override val modVersion: String,
|
||||
override val tick: Tick,
|
||||
/** the initial Factorio event (`defines.events`) trigger */
|
||||
val eventType: String,
|
||||
/** game time */
|
||||
val tick: Tick,
|
||||
val data: FactorioObjectData,
|
||||
) : KafkatorioPacket() {
|
||||
@EncodeDefault
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||
@Serializable
|
||||
data class FactorioPrototypes(
|
||||
override val modVersion: String,
|
||||
override val tick: Tick,
|
||||
val prototypes: List<FactorioPrototype>,
|
||||
) : KafkatorioPacket() {
|
||||
@EncodeDefault
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||
sealed class KafkatorioPacket {
|
||||
/** Schema versioning */
|
||||
abstract val modVersion: String
|
||||
abstract val tick: Tick
|
||||
@EncodeDefault
|
||||
abstract val packetType: PacketType
|
||||
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ class FactorioEventTest : FunSpec({
|
|||
{
|
||||
"modVersion": "0.2.8",
|
||||
"packetType": "CONFIG",
|
||||
"tick": 534,
|
||||
"allMods": [
|
||||
{
|
||||
"modName": "kafkatorio-events",
|
||||
|
|
@ -310,6 +311,7 @@ class FactorioEventTest : FunSpec({
|
|||
|
||||
val expected = FactorioConfigurationUpdate(
|
||||
modVersion = "0.2.8",
|
||||
tick = Tick(534u),
|
||||
factorioData = FactorioGameDataUpdate(null, null),
|
||||
allMods = listOf(
|
||||
FactorioModInfo(
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
{
|
||||
"modVersion":"0.2.4",
|
||||
"packetType":"PROTOTYPES",
|
||||
"tick": 534,
|
||||
"prototypes":[
|
||||
{
|
||||
"prototypeObjectName":"LuaTilePrototype",
|
||||
|
|
@ -46,6 +47,7 @@ class PrototypesTest : BehaviorSpec({
|
|||
{
|
||||
"modVersion":"0.3.2",
|
||||
"packetType":"PROTOTYPES",
|
||||
"tick": 534,
|
||||
"prototypes":[
|
||||
{
|
||||
"prototypeObjectName":"LuaTilePrototype",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue