1
0
forked from noxious/client
This commit is contained in:
2025-01-07 22:20:46 +01:00
parent c2db9b5469
commit 574777da80
19 changed files with 385 additions and 416 deletions

View File

@ -22,7 +22,7 @@ export const useGameStore = defineStore('game', {
game: {
isLoading: false,
isLoaded: false, // isLoaded is currently being used to determine if the player has interacted with the game
loadedAssets: [] as TextureData[],
loadedAssets: [] as string[],
isPlayerDraggingCamera: false,
isCameraFollowingCharacter: false
},
@ -37,15 +37,9 @@ export const useGameStore = defineStore('game', {
getLoadedAssets: (state) => {
return state.game.loadedAssets
},
getLoadedAsset: (state) => {
return (key: string | undefined) => {
if (!key) return null
return state.game.loadedAssets.find((asset) => asset.key === key)
}
isAssetLoaded: (state) => {
return (key: string) => { return state.game.loadedAssets.includes(key)}
},
getLoadedAssetsByGroup: (state) => {
return (group: string) => state.game.loadedAssets.filter((asset) => asset.group === group)
}
},
actions: {
addNotification(notification: Notification) {

View File

@ -4,7 +4,7 @@ import { defineStore } from 'pinia'
export const useMapStore = defineStore('map', {
state: () => {
return {
map: null as Map | null,
mapId: '',
characters: [] as MapCharacter[],
characterLoaded: false
}
@ -16,13 +16,10 @@ export const useMapStore = defineStore('map', {
getCharacterCount: (state) => {
return state.characters.length
},
isMapSet: (state) => {
return state.map !== null
}
},
actions: {
setMap(map: Map | null) {
this.map = map
setMapId(mapId: UUID) {
this.mapId = mapId
},
setCharacters(characters: MapCharacter[]) {
this.characters = characters
@ -50,7 +47,7 @@ export const useMapStore = defineStore('map', {
}
},
reset() {
this.map = null
this.mapId = ''
this.characters = []
this.characterLoaded = false
}