1
0
forked from noxious/client

Added search functionality for tiles and objects, finished object management and added its logic to the zone editor

This commit is contained in:
2024-07-06 21:15:22 +02:00
parent d5a32de32e
commit 93e54b2164
6 changed files with 88 additions and 43 deletions

View File

@ -1,4 +1,5 @@
import { defineStore } from 'pinia'
import type { Object } from '@/types'
export const useZoneEditorStore = defineStore('zoneEditor', {
state: () => ({
@ -7,11 +8,11 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
width: 10,
height: 10,
tiles: [] as string[][],
objects: [] as number[][],
objects: [] as Object[],
tool: 'move',
drawMode: 'tile',
selectedTile: '',
selectedObject: null,
selectedObject: null as Object | null,
isSettingsModalShown: false
}),
actions: {
@ -33,11 +34,11 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
updateTile(x: number, y: number, tile: string) {
this.tiles[y][x] = tile
},
setObjects(objects: number[][]) {
setObjects(objects: Object[]) {
this.objects = objects
},
updateObject(x: number, y: number, object: number) {
this.objects[y][x] = object
updateObject(index: number, object: Object) {
this.objects[index] = object
},
setTool(tool: string) {
this.tool = tool
@ -59,6 +60,7 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
this.width = 10
this.height = 10
this.tiles = []
this.objects = []
this.tool = 'move'
this.drawMode = 'tile'
this.selectedTile = ''