Map loading fix
This commit is contained in:
parent
96ea83090c
commit
950a9529c0
@ -27,16 +27,9 @@ import { Container, Image, TilemapLayer as TilemapLayerC, useScene } from 'phavu
|
||||
import { onBeforeMount, onBeforeUnmount, ref, toRaw, watch } from 'vue'
|
||||
import Controls from '@/components/utilities/Controls.vue'
|
||||
import { useGameStore } from '@/stores/game'
|
||||
import Toolbar from '@/components/utilities/zoneEditor/Toolbar.vue'
|
||||
import Tiles from '@/components/utilities/zoneEditor/Tiles.vue'
|
||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
import ZoneSettings from '@/components/utilities/zoneEditor/ZoneSettings.vue'
|
||||
import { placeTile, setAllTiles, tileToWorldX, tileToWorldY } from '@/services/zone'
|
||||
import { useAssetStore } from '@/stores/assets'
|
||||
import Objects from '@/components/utilities/zoneEditor/Objects.vue'
|
||||
import type { Zone, ZoneEventTile, ZoneObject, Character as CharacterT } from '@/types'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import ZoneList from '@/components/utilities/zoneEditor/ZoneList.vue'
|
||||
import Tileset = Phaser.Tilemaps.Tileset
|
||||
import TilemapLayer = Phaser.Tilemaps.TilemapLayer
|
||||
import { useZoneStore } from '@/stores/zone'
|
||||
@ -48,8 +41,8 @@ const assetStore = useAssetStore()
|
||||
const zoneStore = useZoneStore()
|
||||
|
||||
const zoneData = new Phaser.Tilemaps.MapData({
|
||||
width: zoneStore.zone?.width ?? 10,
|
||||
height: zoneStore.zone?.height ?? 10,
|
||||
width: gameStore.character?.zone?.width ?? 10,
|
||||
height: gameStore.character?.zone?.height ?? 10,
|
||||
tileWidth: config.tile_size.x,
|
||||
tileHeight: config.tile_size.y,
|
||||
orientation: Phaser.Tilemaps.Orientation.ISOMETRIC,
|
||||
@ -80,7 +73,7 @@ toRaw(assetStore.assets).forEach((asset) => {
|
||||
tilesetImages.push(zoneTilemap.addTilesetImage('blank_tile', 'blank_tile', config.tile_size.x, config.tile_size.y, 0, 0, 0) as Tileset)
|
||||
|
||||
const tiles = zoneTilemap.createBlankLayer('tiles', tilesetImages, 0, config.tile_size.y) as TilemapLayer
|
||||
const exampleTilesArray = Array.from({ length: zoneStore.zone?.width ?? 0 }, () => Array.from({ length: zoneStore.zone?.height ?? 0 }, () => 'blank_tile'))
|
||||
const exampleTilesArray = Array.from({ length: gameStore.character?.zone?.width ?? 0 }, () => Array.from({ length: gameStore.character?.zone?.height ?? 0 }, () => 'blank_tile'))
|
||||
|
||||
// Listen for player join events
|
||||
gameStore.connection?.on('zone:character:join', (data: CharacterT) => {
|
||||
@ -126,7 +119,7 @@ onBeforeMount(() => {
|
||||
})
|
||||
}
|
||||
|
||||
zoneObjects.value = zoneStore.zone?.zoneObjects ?? []
|
||||
zoneObjects.value = gameStore.character?.zone?.zoneObjects ?? []
|
||||
|
||||
// Original
|
||||
type TResponse = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const dev: boolean = false
|
||||
const dev: boolean = true
|
||||
|
||||
export default {
|
||||
name: 'New Quest',
|
||||
|
@ -9,7 +9,7 @@
|
||||
<Hud />
|
||||
</div>
|
||||
<div v-if="isLoaded">
|
||||
<World :key="gameStore.character?.zoneId ?? 1" />
|
||||
<World :key="gameStore.character?.zoneId" />
|
||||
</div>
|
||||
<div class="flex absolute justify-between left-0 right-0 bottom-[100px] h-[100px] mx-[48px] my-0" v-if="isLoaded">
|
||||
<Chat />
|
||||
@ -44,7 +44,6 @@ import ZoneEditor from '@/components/utilities/zoneEditor/ZoneEditor.vue'
|
||||
import GmPanel from '@/components/utilities/GmPanel.vue'
|
||||
|
||||
const gameStore = useGameStore()
|
||||
const zoneStore = useZoneStore()
|
||||
const zoneEditorStore = useZoneEditorStore()
|
||||
const assetStore = useAssetStore()
|
||||
const isLoaded = ref(false)
|
||||
|
Loading…
x
Reference in New Issue
Block a user