forked from noxious/client
bruhmoment
This commit is contained in:
parent
be4c201d81
commit
f3b56ef5fa
@ -24,12 +24,20 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeMount, onUnmounted, ref, watch } from 'vue'
|
||||
import { computed, onBeforeMount, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { Container, Image, useScene } from 'phavuer'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useGameStore } from '@/stores/game'
|
||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
import { calculateIsometricDepth, placeTile, setAllTiles, sortByIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
|
||||
import {
|
||||
calculateIsometricDepth,
|
||||
loadAssets,
|
||||
placeTile,
|
||||
setAllTiles,
|
||||
sortByIsometricDepth,
|
||||
tileToWorldX,
|
||||
tileToWorldY
|
||||
} from '@/composables/zoneComposable'
|
||||
import { ZoneEventTileType, type ZoneObject, type ZoneEventTile, type Zone } from '@/types'
|
||||
import { uuidv4 } from '@/utilities'
|
||||
import config from '@/config'
|
||||
@ -312,4 +320,9 @@ const setSelectedZoneObject = (zoneObject: ZoneObject | null) => {
|
||||
if (zoneEditorStore.tool !== 'move') return
|
||||
zoneEditorStore.setSelectedZoneObject(zoneObject)
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
await gameStore.fetchAllZoneAssets()
|
||||
await loadAssets(scene)
|
||||
});
|
||||
</script>
|
||||
|
@ -42,7 +42,6 @@ gameStore.connection!.on('zone:teleport', async (data: zoneLoadData) => {
|
||||
|
||||
// Fetch assets for new zone
|
||||
await gameStore.fetchZoneAssets(data.zone.id)
|
||||
// wait 1.5 sec
|
||||
await loadAssets(scene)
|
||||
|
||||
/**
|
||||
|
@ -68,8 +68,8 @@ export const useGameStore = defineStore('game', {
|
||||
return false
|
||||
})
|
||||
},
|
||||
async fetchAllAssets() {
|
||||
return fetch(config.server_endpoint + '/assets')
|
||||
async fetchAllZoneAssets() {
|
||||
return fetch(config.server_endpoint + '/assets/zone')
|
||||
.then((response) => response.json())
|
||||
.then((assets) => {
|
||||
// Only add the zones that are not already in the store
|
||||
|
Loading…
x
Reference in New Issue
Block a user