Added world settings type and added it into gameStore

This commit is contained in:
2024-10-14 20:11:30 +02:00
parent 1bdd2bc75a
commit 8b1efca7b8
4 changed files with 23 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { io, Socket } from 'socket.io-client'
import type { Asset, Character, Notification, User } from '@/types'
import type { Asset, Character, Notification, User, WorldSettings } from '@/types'
import config from '@/config'
import { useCookies } from '@vueuse/integrations/useCookies'
@ -15,6 +15,12 @@ export const useGameStore = defineStore('game', {
user: null as User | null,
character: null as Character | null,
isPlayerDraggingCamera: false,
world: {
date: new Date(),
isRainEnabled: false,
isFogEnabled: false,
fogDensity: 0.5
} as WorldSettings,
gameSettings: {
isCameraFollowingCharacter: false
},
@ -150,6 +156,7 @@ export const useGameStore = defineStore('game', {
useCookies().remove('token', {
// for whole domain
// @TODO : #190
domain: window.location.hostname.split('.').slice(-2).join('.')
})
@ -163,6 +170,11 @@ export const useGameStore = defineStore('game', {
this.gameSettings.isCameraFollowingCharacter = false
this.uiSettings.isChatOpen = false
this.uiSettings.isUserPanelOpen = false
this.world.date = new Date()
this.world.isRainEnabled = false
this.world.isFogEnabled = false
this.world.fogDensity = 0.5
}
}
})