Re-enabled vue dev tools, moved type into types.ts, added temp. logging

This commit is contained in:
2024-12-28 17:27:00 +01:00
parent b4f9b11143
commit 744df2e2dc
5 changed files with 14 additions and 9 deletions

View File

@ -10,7 +10,7 @@ import { useScene } from 'phavuer'
import { useGameStore } from '@/stores/gameStore'
import { useZoneStore } from '@/stores/zoneStore'
import { loadZoneTilesIntoScene } from '@/composables/zoneComposable'
import type { Zone as ZoneT, ZoneCharacter } from '@/application/types'
import type { Zone as ZoneT, ZoneCharacter, zoneLoadData } from '@/application/types'
import ZoneTiles from '@/components/game/zone/ZoneTiles.vue'
import ZoneObjects from '@/components/game/zone/ZoneObjects.vue'
import Characters from '@/components/game/zone/Characters.vue'
@ -21,11 +21,6 @@ const zoneStore = useZoneStore()
const tileMap = ref(null as Phaser.Tilemaps.Tilemap | null)
type zoneLoadData = {
zone: ZoneT
characters: ZoneCharacter[]
}
// Event listeners
gameStore.connection!.on('zone:character:teleport', async (data: zoneLoadData) => {
/**
@ -43,6 +38,7 @@ gameStore.connection!.on('zone:character:teleport', async (data: zoneLoadData) =
gameStore.connection!.on('zone:character:join', async (data: ZoneCharacter) => {
// If data is from the current user, don't add it to the store
// @TODO: Fix this
if (data.character.id === gameStore.character?.id) return
zoneStore.addCharacter(data)
})
@ -57,6 +53,7 @@ gameStore.connection!.on('character:move', (data: { id: number; positionX: numbe
// Emit zone:character:join event to server and wait for response, then set zone and characters
gameStore!.connection!.emit('zone:character:join', async (response: zoneLoadData) => {
console.log(response)
await loadZoneTilesIntoScene(response.zone, scene)
zoneStore.setZone(response.zone)
zoneStore.setCharacters(response.characters)