1
0
forked from noxious/client

#327 : Fixed map load bug after closing map editor

This commit is contained in:
Dennis Postma 2025-02-05 17:01:27 +01:00
parent fdbc101f96
commit d2abf8fda8

View File

@ -15,7 +15,7 @@ import { MapStorage } from '@/storage/storages'
import { useGameStore } from '@/stores/gameStore'
import { useMapStore } from '@/stores/mapStore'
import { useScene } from 'phavuer'
import { onUnmounted, shallowRef, watch } from 'vue'
import { onMounted, onUnmounted, shallowRef, watch } from 'vue'
const scene = useScene()
@ -74,6 +74,11 @@ watch(
}
)
onMounted(async () => {
if (!mapStore.mapId) return
await initialize()
})
onUnmounted(() => {
if (tileMap.value) {
tileMap.value.destroyLayer('tiles')
@ -81,7 +86,6 @@ onUnmounted(() => {
tileMap.value.destroy()
}
mapStore.reset()
gameStore.connection?.off('map:character:teleport')
gameStore.connection?.off('map:character:join')
gameStore.connection?.off('map:character:leave')