diff --git a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/App.kt b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/App.kt index dc0d26f..6d054fd 100644 --- a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/App.kt +++ b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/App.kt @@ -1,5 +1,8 @@ package dev.adamko.kafkatorio.webmap +import dev.adamko.kafkatorio.webmap.state.FactorioGameState +import dev.adamko.kafkatorio.webmap.state.FactorioUpdate +import dev.adamko.kafkatorio.webmap.state.createFactorioReduxStore import io.kvision.Application import io.kvision.BootstrapCssModule import io.kvision.BootstrapIconsModule diff --git a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state/state.kt similarity index 97% rename from modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt rename to modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state/state.kt index 52f4191..a9cb741 100644 --- a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state.kt +++ b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/state/state.kt @@ -1,4 +1,4 @@ -package dev.adamko.kafkatorio.webmap +package dev.adamko.kafkatorio.webmap.state import dev.adamko.kafkatorio.schema.common.Colour import dev.adamko.kafkatorio.schema.common.MapEntityPosition @@ -7,6 +7,8 @@ import dev.adamko.kafkatorio.schema.common.SurfaceIndex import dev.adamko.kafkatorio.schema.common.Tick import dev.adamko.kafkatorio.schema.common.toHexString import dev.adamko.kafkatorio.schema.packets.PlayerUpdate +import dev.adamko.kafkatorio.webmap.FactorioMap +import dev.adamko.kafkatorio.webmap.latLng import io.kvision.maps.Maps.Companion.L import io.kvision.maps.externals.leaflet.geo.LatLng import io.kvision.maps.externals.leaflet.layer.LayerGroup diff --git a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/websockets.kt b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/websockets.kt index cdeffb9..51e7708 100644 --- a/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/websockets.kt +++ b/modules/web-map/src/main/kotlin/dev/adamko/kafkatorio/webmap/websockets.kt @@ -9,8 +9,9 @@ import dev.adamko.kafkatorio.schema.packets.MapChunkUpdate import dev.adamko.kafkatorio.schema.packets.PlayerUpdate import dev.adamko.kafkatorio.schema.packets.PrototypesUpdate import dev.adamko.kafkatorio.schema.packets.SurfaceUpdate +import dev.adamko.kafkatorio.webmap.state.FactorioGameState +import dev.adamko.kafkatorio.webmap.state.FactorioUpdate import io.kvision.redux.ReduxStore -import kotlinx.serialization.decodeFromString import org.w3c.dom.MessageEvent import org.w3c.dom.WebSocket @@ -36,7 +37,7 @@ class WebsocketService( println(data.replace('\n', ' ')) - val packet: KafkatorioPacket = jsonMapper.decodeFromString(data) + val packet = jsonMapper.decodeFromString(KafkatorioPacket.serializer(), data) when (val packetData = packet.data) {