- start migrating tile-server to use Ktor

- start splitting up Kafka processor and tile-server to two subprojects
This commit is contained in:
Adam 2022-07-01 13:14:32 +02:00
parent ae9ecc24f5
commit 8a90c4fb5e
22 changed files with 735 additions and 876 deletions

View file

@ -11,6 +11,9 @@ plugins {
}
description = "shared data structures and utilities"
kotlin {
js(IR) {

View file

@ -80,16 +80,33 @@ data class ServerMapChunkId(
)
/** `${serverDataDir}/servers/{serverId}/map/tiles/s{surfaceIndex}/z{zoomLevel}/x{chunkX}/y{chunkY}.png` */
@Serializable
@JvmInline
value class TilePngFilename(
val value: String,
) {
constructor(id: ServerMapChunkId) : this(buildString {
append("s${id.surfaceIndex}")
append("/z${id.chunkSize.zoomLevel}")
append("/x${id.chunkPosition.x}")
append("/y${id.chunkPosition.y}")
constructor(id: ServerMapChunkId) : this(
id.serverId,
id.surfaceIndex,
id.chunkSize.zoomLevel,
id.chunkPosition.x,
id.chunkPosition.y,
)
constructor(
serverId: FactorioServerId,
surfaceIndex: SurfaceIndex,
zoomLevel: Int,
chunkX: Int,
chunkY: Int,
) : this(buildString {
append("servers/${serverId}")
append("/map/tiles")
append("/s${surfaceIndex}")
append("/z${zoomLevel}")
append("/x${chunkX}")
append("/y${chunkY}")
append(".png")
})
}