1
0
forked from noxious/client

Bug fixes for updating zone width and height (realtime now), removed redundant code from camera composable, improved zone editor tool modal logics.

This commit is contained in:
2024-09-14 21:40:42 +02:00
parent 717fb1646c
commit bb08aaa9bc
9 changed files with 98 additions and 85 deletions

View File

@ -27,6 +27,12 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
isZoneListModalShown: false,
isCreateZoneModalShown: false,
isSettingsModalShown: false,
zoneSettings: {
name: '',
width: 0,
height: 0,
pvp: false
},
teleportSettings: {
toZoneId: 0,
toPositionX: 0,
@ -38,28 +44,21 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
if (this.active) this.reset()
this.active = !this.active
},
setZone(zone: Zone) {
setZone(zone: Zone | null) {
this.zone = zone
},
setZoneName(name: string) {
if (this.zone) {
this.zone.name = name
}
this.zoneSettings.name = name
},
setZoneWidth(width: number) {
if (this.zone) {
this.zone.width = width
}
this.zoneSettings.width = width
},
setZoneHeight(height: number) {
if (this.zone) {
this.zone.height = height
}
this.zoneSettings.height = height
},
setZonePvp(pvp: boolean) {
if (this.zone) {
this.zone.pvp = pvp
}
if (!this.zone) return
this.zone.pvp = pvp
},
setTool(tool: string) {
this.tool = tool
@ -86,9 +85,6 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
this.selectedObject = object
},
setSelectedZoneObject(zoneObject: ZoneObject | null) {
const gameStore = useGameStore() // Access the gameStore
if (gameStore.isMovingCamera) return // Step 2: Check isMovingCamera before proceeding
this.selectedZoneObject = zoneObject
},
setObjectDepth(depth: number) {
@ -108,6 +104,7 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
this.teleportSettings = teleportSettings
},
reset() {
// this.zone = null
this.zoneList = []
this.tileList = []
this.objectList = []