make factorio ID value classes, nicer, and remove 'EncodeDefault' from colours
This commit is contained in:
parent
99a7167485
commit
ebb8482201
5 changed files with 17 additions and 19 deletions
|
|
@ -67,13 +67,9 @@ data class MapBoundingBox(
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Colour(
|
data class Colour(
|
||||||
@EncodeDefault // remove encode default?
|
|
||||||
val red: Float = 0f,
|
val red: Float = 0f,
|
||||||
@EncodeDefault
|
|
||||||
val green: Float = 0f,
|
val green: Float = 0f,
|
||||||
@EncodeDefault
|
|
||||||
val blue: Float = 0f,
|
val blue: Float = 0f,
|
||||||
@EncodeDefault
|
|
||||||
val alpha: Float = 1f,
|
val alpha: Float = 1f,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -81,13 +77,9 @@ data class Colour(
|
||||||
/** Size-efficient version of [Colour] (`4*4` bytes vs `4*1` bytes) */
|
/** Size-efficient version of [Colour] (`4*4` bytes vs `4*1` bytes) */
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ColourHex(
|
data class ColourHex(
|
||||||
@EncodeDefault // remove encode default?
|
|
||||||
val red: UByte = UByte.MIN_VALUE,
|
val red: UByte = UByte.MIN_VALUE,
|
||||||
@EncodeDefault
|
|
||||||
val green: UByte = UByte.MIN_VALUE,
|
val green: UByte = UByte.MIN_VALUE,
|
||||||
@EncodeDefault
|
|
||||||
val blue: UByte = UByte.MIN_VALUE,
|
val blue: UByte = UByte.MIN_VALUE,
|
||||||
@EncodeDefault
|
|
||||||
val alpha: UByte = UByte.MAX_VALUE,
|
val alpha: UByte = UByte.MAX_VALUE,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
||||||
|
|
@ -11,26 +11,36 @@ import kotlinx.serialization.Serializable
|
||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class SurfaceIndex(val value: UInt)
|
value class SurfaceIndex(private val id: UInt) {
|
||||||
|
override fun toString(): String = "$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class ForceIndex(val value: UInt)
|
value class ForceIndex(private val id: UInt) {
|
||||||
|
override fun toString(): String = "$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** The player's index in `LuaGameScript::players` */
|
/** The player's index in `LuaGameScript::players` */
|
||||||
@Serializable
|
@Serializable
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class PlayerIndex(val value: UInt)
|
value class PlayerIndex(private val id: UInt) {
|
||||||
|
override fun toString(): String = "$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This is universally unique for every entity that has one, for the lifetime of a whole game. */
|
/** This is universally unique for every entity that has one, for the lifetime of a whole game. */
|
||||||
@Serializable
|
@Serializable
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class UnitNumber(val value: UInt)
|
value class UnitNumber(private val id: UInt) {
|
||||||
|
override fun toString(): String = "$id"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@JvmInline
|
@JvmInline
|
||||||
value class PrototypeName(val value: String)
|
value class PrototypeName(private val id: String) {
|
||||||
|
override fun toString(): String = id
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,7 @@ class FactorioEventTest : FunSpec({
|
||||||
"chatColour": {
|
"chatColour": {
|
||||||
"red": 1,
|
"red": 1,
|
||||||
"green": 0.62,
|
"green": 0.62,
|
||||||
"blue": 0.25,
|
"blue": 0.25
|
||||||
"alpha": 1
|
|
||||||
},
|
},
|
||||||
"lastOnline": 2287061
|
"lastOnline": 2287061
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,6 @@ import org.http4k.server.Undertow
|
||||||
import org.http4k.server.asServer
|
import org.http4k.server.asServer
|
||||||
|
|
||||||
|
|
||||||
//private val appProps = ApplicationProperties()
|
|
||||||
|
|
||||||
|
|
||||||
fun main(): Unit = runBlocking {
|
fun main(): Unit = runBlocking {
|
||||||
|
|
||||||
KafkatorioKafkaAdmin.createKafkatorioTopics()
|
KafkatorioKafkaAdmin.createKafkatorioTopics()
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ private value class TilePngFilename(
|
||||||
) {
|
) {
|
||||||
constructor(cmd: Cmd.CreateImage) : this(buildString {
|
constructor(cmd: Cmd.CreateImage) : this(buildString {
|
||||||
append("src/main/resources/kafkatorio-web-map")
|
append("src/main/resources/kafkatorio-web-map")
|
||||||
append("/s${cmd.surfaceIndex.value}")
|
append("/s${cmd.surfaceIndex}")
|
||||||
append("/z${cmd.chunkSize.zoomLevel}")
|
append("/z${cmd.chunkSize.zoomLevel}")
|
||||||
append("/x${cmd.chunkPosition.x}")
|
append("/x${cmd.chunkPosition.x}")
|
||||||
append("/y${cmd.chunkPosition.y}")
|
append("/y${cmd.chunkPosition.y}")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue