Minor improvement

This commit is contained in:
Dennis Postma 2024-09-29 16:07:55 +02:00
parent df3b9db45d
commit 1f46b94441
3 changed files with 57 additions and 51 deletions

@ -5,7 +5,8 @@ import config from '@/config'
import { useCookies } from '@vueuse/integrations/useCookies'
export const useGameStore = defineStore('game', {
state: () => ({
state: () => {
return {
notifications: [] as Notification[],
assets: [] as Asset[],
token: '' as string | null,
@ -21,7 +22,8 @@ export const useGameStore = defineStore('game', {
isUserPanelOpen: false,
isGmPanelOpen: false
}
}),
}
},
getters: {
getNotifications: (state: any) => state.notifications,
getAssetByKey: (state) => {

@ -10,7 +10,8 @@ type TeleportSettings = {
}
export const useZoneEditorStore = defineStore('zoneEditor', {
state: () => ({
state: () => {
return {
active: false,
zone: null as Zone | null,
tool: 'move',
@ -40,7 +41,8 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
toPositionY: 0,
toRotation: 0
}
}),
}
},
actions: {
toggleActive() {
const gameStore = useGameStore()

@ -2,11 +2,13 @@ import { defineStore } from 'pinia'
import type { ExtendedCharacter, Zone } from '@/types'
export const useZoneStore = defineStore('zone', {
state: () => ({
state: () => {
return {
zone: null as Zone | null,
characters: [] as ExtendedCharacter[],
characterLoaded: false
}),
}
},
getters: {
getCharacterById: (state) => {
return (id: number) => state.characters.find((char) => char.id === id)