i dont even remember, something, something, zone editor

This commit is contained in:
2024-06-13 20:28:34 +02:00
parent 12445db7f1
commit 4bc076d55d
17 changed files with 479 additions and 207 deletions

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import type { Character } from '@/types'
import config from '@/config'
export const useZoneStore = defineStore('zone', {
state: () => ({
@ -23,6 +24,10 @@ export const useZoneStore = defineStore('zone', {
},
removeCharacter(character: Character) {
this.characters = this.characters.filter((c: Character) => c.id !== character.id)
},
reset() {
this.tiles = []
this.characters = []
}
}
})

View File

@ -1,25 +1,56 @@
import { defineStore } from 'pinia'
import config from '@/config'
import {type Zone} from '@/types'
export const useZoneEditorStore = defineStore('zoneEditor', {
state: () => ({
active: true,
active: false,
tiles: [] as number[][],
tool: 'move',
drawMode: 'tile',
selectedTile: null,
selectedWall: null,
selectedDecoration: null,
zoneSettings: null as Zone | null,
zoneSettingsOpen: false
}),
actions: {
toggleActive() {
this.active = !this.active
},
setTiles(tiles: number[][]) {
this.tiles = tiles
},
setTool(tool: string) {
this.tool = tool
},
setDrawMode(mode: string) {
this.drawMode = mode
},
setSelectedTile(tile: any) {
this.selectedTile = tile
},
setSelectedWall(wall: any) {
this.selectedWall = wall
},
setSelectedDecoration(decoration: any) {
this.selectedDecoration = decoration
},
setZoneSettings(zone: Zone) {
this.zoneSettings = zone
},
toggleZoneSettings() {
this.zoneSettingsOpen = !this.zoneSettingsOpen
},
reset() {
this.tiles = []
this.tool = 'move'
this.drawMode = 'tile'
this.selectedTile = null
this.selectedWall = null
this.selectedDecoration = null
this.zoneSettings = null
this.zoneSettingsOpen = false
}
}
})
/**
* [[0,0,0,0,0,0,0,0,0,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,0],[0,0,0,0,0,0,0,0,0,0]]
*/
})