tidying up schema files
This commit is contained in:
parent
7f65ec025c
commit
1c55fae236
5 changed files with 10 additions and 366 deletions
|
|
@ -1,68 +0,0 @@
|
|||
package dev.adamko.kafkatorio.schema.events
|
||||
//
|
||||
//import dev.adamko.kafkatorio.schema.SerializerProvider
|
||||
//import dev.adamko.kafkatorio.schema.SerializerProviderDeserializer
|
||||
//import dev.adamko.kafkatorio.schema.common.Tick
|
||||
//import kotlin.reflect.KClass
|
||||
//import kotlin.reflect.KType
|
||||
//import kotlin.reflect.typeOf
|
||||
//import kotlinx.serialization.KSerializer
|
||||
//import kotlinx.serialization.Serializable
|
||||
//
|
||||
//
|
||||
////@Serializable
|
||||
////data class KafkatorioPacket(
|
||||
//// val modVersion: String,
|
||||
//// val tick: Tick,
|
||||
//// val data: KafkatorioPacketData,
|
||||
////)
|
||||
//
|
||||
//
|
||||
//@Serializable(with = KafkatorioPacketData.JsonSerializer::class)
|
||||
//sealed class KafkatorioPacketData {
|
||||
// abstract val updateType: KafkatorioPacketDataType
|
||||
//
|
||||
// object JsonSerializer : SerializerProviderDeserializer<KafkatorioPacketData>(
|
||||
// KafkatorioPacketData::class,
|
||||
// KafkatorioPacketData::updateType.name,
|
||||
// { json -> KafkatorioPacketDataType.entries.firstOrNull { it.name == json } }
|
||||
// )
|
||||
//}
|
||||
//
|
||||
//
|
||||
///** Discriminator for [KafkatorioPacketData] */
|
||||
//@Serializable
|
||||
//enum class KafkatorioPacketDataType(
|
||||
// override val serializer: KSerializer<out KafkatorioPacketData>
|
||||
//) : SerializerProvider<KafkatorioPacketData> {
|
||||
//
|
||||
// // non-keyed
|
||||
// CONFIG(ConfigurationUpdate.serializer()),
|
||||
// CONSOLE_CHAT(ConsoleChatUpdate.serializer()),
|
||||
// CONSOLE_COMMAND(ConsoleCommandUpdate.serializer()),
|
||||
// PROTOTYPES(PrototypesUpdate.serializer()),
|
||||
// SURFACE(SurfaceUpdate.serializer()),
|
||||
//
|
||||
// // keyed
|
||||
// ENTITY(EntityUpdate.serializer()),
|
||||
// MAP_CHUNK(MapChunkUpdate.serializer()),
|
||||
// PLAYER(PlayerUpdate.serializer()),
|
||||
// ;
|
||||
//
|
||||
// companion object {
|
||||
// val entries: Set<KafkatorioPacketDataType> = values().toSet()
|
||||
// }
|
||||
//}
|
||||
//
|
||||
////inline fun <reified T: KafkatorioPacketData> KafkatorioPacketDataType.isType (): KClass<out T> {
|
||||
//// return when (this) {
|
||||
//// KafkatorioPacketDataType.CONFIG -> ConfigurationUpdate::class
|
||||
//// KafkatorioPacketDataType.CONSOLE_CHAT -> ConsoleChatUpdate::class
|
||||
//// KafkatorioPacketDataType.CONSOLE_COMMAND -> ConsoleCommandUpdate::class
|
||||
//// KafkatorioPacketDataType.PROTOTYPES -> PrototypesUpdate::class
|
||||
//// KafkatorioPacketDataType.SURFACE -> SurfaceUpdate::class
|
||||
//// KafkatorioPacketDataType.ENTITY -> EntityUpdate::class
|
||||
//// KafkatorioPacketDataType.MAP_CHUNK -> MapChunkUpdate::class
|
||||
//// KafkatorioPacketDataType.PLAYER -> PlayerUpdate::class
|
||||
//// }
|
||||
////}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
package dev.adamko.kafkatorio.schema.events
|
||||
//
|
||||
//import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||
//import dev.adamko.kafkatorio.schema.common.SurfaceIndex
|
||||
//import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype
|
||||
//import kotlinx.serialization.EncodeDefault
|
||||
//import kotlinx.serialization.Serializable
|
||||
//
|
||||
//
|
||||
///** No key, no caching. Must be sent instantly. */
|
||||
//sealed class KafkatorioInstantPacketData : KafkatorioPacketData()
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class ConfigurationUpdate(
|
||||
// val factorioData: ConfigurationUpdateGameData,
|
||||
// val allMods: List<ConfigurationUpdateModData>,
|
||||
// val modStartupSettingsChange: Boolean,
|
||||
// val migrationApplied: Boolean,
|
||||
//) : KafkatorioInstantPacketData() {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.CONFIG
|
||||
//
|
||||
// @Serializable
|
||||
// data class ConfigurationUpdateGameData(
|
||||
// val oldVersion: String? = null,
|
||||
// val newVersion: String? = null,
|
||||
// )
|
||||
//
|
||||
// @Serializable
|
||||
// data class ConfigurationUpdateModData(
|
||||
// val modName: String,
|
||||
// val currentVersion: String? = null,
|
||||
// val previousVersion: String? = null,
|
||||
// )
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class ConsoleChatUpdate(
|
||||
// val authorPlayerIndex: PlayerIndex?,
|
||||
// val content: String,
|
||||
//) : KafkatorioInstantPacketData() {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.CONSOLE_CHAT
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class ConsoleCommandUpdate(
|
||||
// val authorPlayerIndex: PlayerIndex?,
|
||||
// val command: String,
|
||||
// val parameters: String,
|
||||
//) : KafkatorioInstantPacketData() {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.CONSOLE_COMMAND
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class PrototypesUpdate(
|
||||
// val prototypes: List<FactorioPrototype>,
|
||||
//) : KafkatorioInstantPacketData() {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.PROTOTYPES
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class SurfaceUpdate(
|
||||
// val index: SurfaceIndex,
|
||||
// val daytime: Double,
|
||||
// val name: String,
|
||||
//) : KafkatorioInstantPacketData() {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.SURFACE
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
package dev.adamko.kafkatorio.schema.events
|
||||
|
||||
//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.ForceIndex
|
||||
//import dev.adamko.kafkatorio.schema.common.MapChunkPosition
|
||||
//import dev.adamko.kafkatorio.schema.common.MapEntityPosition
|
||||
//import dev.adamko.kafkatorio.schema.common.MapTileDictionary
|
||||
//import dev.adamko.kafkatorio.schema.common.PlayerIndex
|
||||
//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.EncodeDefault
|
||||
//import kotlinx.serialization.Serializable
|
||||
//
|
||||
//
|
||||
//sealed interface KafkatorioKeyedPacketKey
|
||||
//
|
||||
//
|
||||
///** Has a key, so it can be debounced */
|
||||
//sealed class KafkatorioKeyedPacketData : KafkatorioPacketData() {
|
||||
// /** Count how many events this packet is aggregating data from */
|
||||
// abstract val eventCounts: Map<String, UInt>?
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//sealed interface EntityUpdateKey : EntityIdentifiers, KafkatorioKeyedPacketKey {
|
||||
// /** A [unitNumber] is required for caching */
|
||||
// override val unitNumber: UnitNumber
|
||||
// override val name: String
|
||||
// override val protoType: String
|
||||
//}
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class EntityUpdate(
|
||||
// override val unitNumber: UnitNumber,
|
||||
// override val name: String,
|
||||
// override val protoType: String,
|
||||
//
|
||||
// override val eventCounts: Map<String, UInt>? = null,
|
||||
//
|
||||
// val chunkPosition: MapChunkPosition? = null,
|
||||
// val graphicsVariation: UByte? = null,
|
||||
// val health: Float? = null,
|
||||
// val isActive: Boolean? = null,
|
||||
// val isRotatable: Boolean? = null,
|
||||
// val lastUser: UInt? = null,
|
||||
// val localisedDescription: String? = null,
|
||||
// val localisedName: String? = null,
|
||||
// val prototype: PrototypeName? = null,
|
||||
//) : KafkatorioKeyedPacketData(), EntityUpdateKey {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.ENTITY
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//sealed interface MapChunkUpdateKey : KafkatorioKeyedPacketKey {
|
||||
// val chunkPosition: MapChunkPosition
|
||||
// val surfaceIndex: SurfaceIndex
|
||||
//}
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class MapChunkUpdate(
|
||||
// override val chunkPosition: MapChunkPosition,
|
||||
// override val surfaceIndex: SurfaceIndex,
|
||||
//
|
||||
// override val eventCounts: Map<String, UInt>? = null,
|
||||
//
|
||||
// val player: PlayerIndex? = null,
|
||||
// val robot: EntityIdentifiersData? = null,
|
||||
// val force: ForceIndex? = null,
|
||||
// /** updated tiles - might be partial and not all tiles in the chunk */
|
||||
// val tileDictionary: MapTileDictionary? = null,
|
||||
// val isDeleted: Boolean? = null,
|
||||
//) : KafkatorioKeyedPacketData(), MapChunkUpdateKey {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.MAP_CHUNK
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
//
|
||||
//
|
||||
//sealed interface PlayerUpdateKey : KafkatorioKeyedPacketKey {
|
||||
// val index: PlayerIndex
|
||||
//}
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class PlayerUpdate(
|
||||
// override val index: PlayerIndex,
|
||||
//
|
||||
// override val eventCounts: Map<String, UInt>? = null,
|
||||
//
|
||||
// val characterUnitNumber: UnitNumber? = null,
|
||||
// val chatColour: Colour? = null,
|
||||
// val colour: Colour? = null,
|
||||
// val name: String? = null,
|
||||
//
|
||||
// val afkTime: Tick? = null,
|
||||
// val ticksToRespawn: Tick? = null,
|
||||
// val forceIndex: ForceIndex? = null,
|
||||
// val isAdmin: Boolean? = null,
|
||||
// val isConnected: Boolean? = null,
|
||||
// val isShowOnMap: Boolean? = null,
|
||||
// val isSpectator: Boolean? = null,
|
||||
// val lastOnline: Tick? = null,
|
||||
// val onlineTime: Tick? = null,
|
||||
// val position: MapEntityPosition? = null,
|
||||
// val surfaceIndex: SurfaceIndex? = null,
|
||||
// val tag: String? = null,
|
||||
// val diedCause: EntityIdentifiersData? = null,
|
||||
//
|
||||
// val bannedReason: String? = null,
|
||||
// val kickedReason: String? = null,
|
||||
// val disconnectReason: String? = null,
|
||||
// /** `true` when a player is removed (deleted) from the game */
|
||||
// val isRemoved: Boolean? = null,
|
||||
//) : KafkatorioKeyedPacketData(), PlayerUpdateKey {
|
||||
// @EncodeDefault
|
||||
// override val updateType: KafkatorioPacketDataType = KafkatorioPacketDataType.PLAYER
|
||||
//}
|
||||
//
|
||||
//
|
||||
///* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
package dev.adamko.kafkatorio.schema.prototypes
|
||||
//
|
||||
//import dev.adamko.kafkatorio.schema.SerializerProvider
|
||||
//import dev.adamko.kafkatorio.schema.SerializerProviderDeserializer
|
||||
//import dev.adamko.kafkatorio.schema.common.Colour
|
||||
//import dev.adamko.kafkatorio.schema.common.PrototypeName
|
||||
//import dev.adamko.kafkatorio.schema.prototypes.FactorioPrototype.PrototypeObjectName
|
||||
//import kotlinx.serialization.Contextual
|
||||
//import kotlinx.serialization.DeserializationStrategy
|
||||
//import kotlinx.serialization.EncodeDefault
|
||||
//import kotlinx.serialization.KSerializer
|
||||
//import kotlinx.serialization.Serializable
|
||||
//import kotlinx.serialization.json.JsonContentPolymorphicSerializer
|
||||
//import kotlinx.serialization.json.JsonElement
|
||||
//import kotlinx.serialization.json.contentOrNull
|
||||
//import kotlinx.serialization.json.jsonObject
|
||||
//import kotlinx.serialization.json.jsonPrimitive
|
||||
//
|
||||
//
|
||||
//@Serializable(with = FactorioPrototype.JsonSerializer::class)
|
||||
//sealed class FactorioPrototype {
|
||||
// @EncodeDefault
|
||||
// abstract val prototypeObjectName: PrototypeObjectName
|
||||
//
|
||||
// enum class PrototypeObjectName(
|
||||
// override val serializer: KSerializer<out FactorioPrototype>
|
||||
// ) : SerializerProvider<FactorioPrototype> {
|
||||
// LuaTilePrototype(MapTilePrototype.serializer()),
|
||||
// ;
|
||||
//
|
||||
// companion object {
|
||||
// val entries: Set<PrototypeObjectName> = values().toSet()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// object JsonSerializer : SerializerProviderDeserializer<FactorioPrototype>(
|
||||
// FactorioPrototype::class,
|
||||
// FactorioPrototype::prototypeObjectName.name,
|
||||
// { json -> PrototypeObjectName.entries.firstOrNull { it.name == json } }
|
||||
// )
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
//@Serializable
|
||||
//data class MapTilePrototype(
|
||||
// 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() {
|
||||
// @EncodeDefault
|
||||
// override val prototypeObjectName: PrototypeObjectName = PrototypeObjectName.LuaTilePrototype
|
||||
//}
|
||||
Loading…
Add table
Add a link
Reference in a new issue