Small cleanup
This commit is contained in:
@ -13,8 +13,7 @@ import type { Character as CharacterT, Zone as ZoneT, ExtendedCharacter as Exten
|
||||
import ZoneTiles from '@/components/zone/ZoneTiles.vue'
|
||||
import ZoneObjects from '@/components/zone/ZoneObjects.vue'
|
||||
import Characters from '@/components/zone/Characters.vue'
|
||||
import { unduplicateArray } from '@/utilities'
|
||||
import { FlattenZoneArray, loadZoneTileTexture } from '@/composables/zoneComposable'
|
||||
import { loadZoneTiles } from '@/composables/zoneComposable'
|
||||
|
||||
const scene = useScene()
|
||||
const gameStore = useGameStore()
|
||||
@ -37,6 +36,7 @@ gameStore.connection!.on('zone:character:teleport', async (data: zoneLoadData) =
|
||||
zoneId: data.zone.id
|
||||
})
|
||||
|
||||
await loadZoneTiles(response.zone, scene)
|
||||
zoneStore.setZone(data.zone)
|
||||
zoneStore.setCharacters(data.characters)
|
||||
})
|
||||
@ -55,13 +55,6 @@ gameStore.connection!.on('character:move', (data: ExtendedCharacterT) => {
|
||||
zoneStore.updateCharacter(data)
|
||||
})
|
||||
|
||||
async function loadZoneTiles(zone: ZoneT, scene: Phaser.Scene) {
|
||||
const tileArray = unduplicateArray(FlattenZoneArray(zone.tiles))
|
||||
for (const tile of tileArray) {
|
||||
await loadZoneTileTexture(scene, tile, new Date())
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 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) => {
|
||||
|
Reference in New Issue
Block a user