forked from noxious/client
stuffs
This commit is contained in:
@ -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) {
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user