Showing placed map object works in both game and map editor, updated types, cleaned some logic

This commit is contained in:
2025-02-05 02:27:18 +01:00
parent 027fdd7dac
commit d2b6d8dcb3
12 changed files with 134 additions and 112 deletions

View File

@ -18,7 +18,7 @@ export const useMapStore = defineStore('map', {
}
},
actions: {
setMapId(mapId: UUID) {
setMapId(mapId: string) {
this.mapId = mapId
},
setCharacters(characters: MapCharacter[]) {
@ -27,11 +27,6 @@ export const useMapStore = defineStore('map', {
addCharacter(character: MapCharacter) {
this.characters.push(character)
},
updateCharacter(updatedCharacter: MapCharacter) {
const index = this.characters.findIndex((char) => char.character.id === updatedCharacter.character.id)
if (index !== -1) this.characters[index] = updatedCharacter
},
// Property is mapCharacter key
updateCharacterProperty<K extends keyof MapCharacter>(characterId: UUID, property: K, value: MapCharacter[K]) {
const character = this.characters.find((char) => char.character.id === characterId)
if (character) {