- mod refactoring into separate files, specific dirs
- start work on emitting prototypes - start preparing for generating map tiles for leaflet - start work on more events - console chat - chunk charted
This commit is contained in:
parent
a0c330384a
commit
58233c9343
16 changed files with 334 additions and 94 deletions
|
|
@ -53,7 +53,8 @@ kotlin {
|
|||
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
implementation("com.github.ntrrgc:ts-generator:1.1.2")
|
||||
implementation("com.github.aSemy:ts-generator:v1.2.1")
|
||||
// implementation("com.github.ntrrgc:ts-generator:1.1.2")
|
||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,3 +149,44 @@ data class Colour(
|
|||
fun isPercentage(): Boolean = !isDecimal()
|
||||
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ConsoleChatMessage(
|
||||
@SerialName("author_player_index")
|
||||
val authorPlayerIndex: UInt?,
|
||||
val content: String,
|
||||
) : FactorioObjectData() {
|
||||
@Transient
|
||||
override val objectName: String = "ConsoleChatMessage"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@SerialName("FactorioTilesMap")
|
||||
data class FactorioTilesMap(
|
||||
val tiles: Map<PositionData, FactorioTile>,
|
||||
) : FactorioObjectData() {
|
||||
@Transient
|
||||
override val objectName: String = "FactorioTilesMap"
|
||||
}
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("FactorioTiles")
|
||||
data class FactorioTiles(
|
||||
val tiles: List<FactorioTile>,
|
||||
) : FactorioObjectData() {
|
||||
@Transient
|
||||
override val objectName: String = "FactorioTiles"
|
||||
}
|
||||
|
||||
|
||||
@Serializable
|
||||
@SerialName("LuaTile")
|
||||
data class FactorioTile(
|
||||
val prototypeName: String,
|
||||
val position: PositionData,
|
||||
val surfaceIndex: Int,
|
||||
) : FactorioObjectData() {
|
||||
@Transient
|
||||
override val objectName: String = "LuaTile"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package dev.adamko.kafkatorio.events.schema
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import kotlinx.serialization.json.JsonClassDiscriminator
|
||||
|
||||
@Serializable
|
||||
@JsonClassDiscriminator(FactorioObjectDataDiscriminatorKey)
|
||||
sealed class FactorioPrototype {
|
||||
abstract val objectName: String
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@SerialName("LuaTilePrototype")
|
||||
data class FactorioMapTilePrototype(
|
||||
val name: String,
|
||||
val layer: UInt,
|
||||
val mapColor: Colour,
|
||||
val collisionMasks: List<String>,
|
||||
val order: String,
|
||||
|
||||
/** Is this tile mineable at all? */
|
||||
val canBeMined: Boolean,
|
||||
) : FactorioPrototype() {
|
||||
@Transient
|
||||
override val objectName: String = "LuaTilePrototype"
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ fun main(args: Array<String>) {
|
|||
buildSet {
|
||||
add(FactorioEvent::class)
|
||||
addAll(FactorioObjectData::class.sealedSubclasses)
|
||||
addAll(FactorioPrototype::class.sealedSubclasses)
|
||||
},
|
||||
mappings = mapOf(
|
||||
// builtin Factorio numeric types > `typed-factorio/generated/builtin-types.d.ts`
|
||||
|
|
@ -56,7 +57,7 @@ fun main(args: Array<String>) {
|
|||
|
||||
@Language("TypeScript")
|
||||
val header = """
|
||||
|// Generated by TypeScriptGenerator - do edit this file manually
|
||||
|// Generated by TypeScriptGenerator - do not edit this file manually
|
||||
|
|
||||
""".trimMargin()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue