yeet
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useAssetStore } from '@/stores/assets'
|
||||
import { useGameStore } from '@/stores/game'
|
||||
import { useZoneStore } from '@/stores/zone'
|
||||
import { onBeforeMount, onBeforeUnmount, ref, watch } from 'vue'
|
||||
@ -13,6 +14,7 @@ import Tiles from '@/components/zone/Tiles.vue'
|
||||
import Objects from '@/components/zone/Objects.vue'
|
||||
import Characters from '@/components/zone/Characters.vue'
|
||||
|
||||
const assetStore = useAssetStore()
|
||||
const gameStore = useGameStore()
|
||||
const zoneStore = useZoneStore()
|
||||
|
||||
@ -23,6 +25,13 @@ type zoneLoadData = {
|
||||
characters: CharacterT[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch assets from the server when a new zone is loaded
|
||||
*/
|
||||
gameStore.connection?.on('zone:character:load_assets', async (zoneId: number) => {
|
||||
await assetStore.fetchAssetsByZoneId(zoneId)
|
||||
})
|
||||
|
||||
gameStore.connection?.emit('zone:character:join', { zoneId: gameStore.character?.zoneId }, (response: zoneLoadData) => {
|
||||
zoneStore.setZone(response.zone)
|
||||
zoneStore.setCharacters(response.characters)
|
||||
|
Reference in New Issue
Block a user