From 5125695b4f2d9bc4a4523406b2efe2eebeb32b20 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Fri, 20 Sep 2024 20:52:17 +0200 Subject: [PATCH] e.e --- src/components/zone/Tiles.vue | 4 +--- src/components/zone/Zone.vue | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/zone/Tiles.vue b/src/components/zone/Tiles.vue index b498449..de3891c 100644 --- a/src/components/zone/Tiles.vue +++ b/src/components/zone/Tiles.vue @@ -11,11 +11,10 @@ import { storeToRefs } from 'pinia' import { placeTile, setAllTiles } from '@/composables/zoneComposable' import Controls from '@/components/utilities/Controls.vue' -const emit = defineEmits(['tilemap:create', 'tilemap:destroy']) +const emit = defineEmits(['tilemap:create']) const zoneStore = useZoneStore() const scene = useScene() -const camera = ref(scene.cameras.main) const { zone } = storeToRefs(zoneStore) const zoneTilemap = createTilemap() @@ -67,7 +66,6 @@ onBeforeMount(() => { }) onBeforeUnmount(() => { - emit('tilemap:destroy') zoneTilemap.destroyLayer('tiles') zoneTilemap.removeAllLayers() zoneTilemap.destroy() diff --git a/src/components/zone/Zone.vue b/src/components/zone/Zone.vue index 29e6486..445f7ab 100644 --- a/src/components/zone/Zone.vue +++ b/src/components/zone/Zone.vue @@ -1,5 +1,5 @@ @@ -37,7 +37,10 @@ gameStore.connection!.emit('zone:character:join', { zoneId: gameStore.character! }) // Event listeners -gameStore.connection!.on('zone:teleport', async (data: zoneLoadData) => { +gameStore.connection!.on('zone:character:teleport', async (data: zoneLoadData) => { + /** + * This is the cause of the bug + */ // Fetch assets for new zone await gameStore.fetchZoneAssets(data.zone.id) await loadAssets(scene) @@ -68,7 +71,7 @@ gameStore.connection!.on('character:move', (data: ExtendedCharacterT) => { onBeforeUnmount(() => { zoneStore.reset() - gameStore.connection!.off('zone:teleport') + gameStore.connection!.off('zone:character:teleport') gameStore.connection!.off('zone:character:join') gameStore.connection!.off('zone:character:leave') gameStore.connection!.off('character:move')