Listen for attack events. TODO: finish anim. handling

This commit is contained in:
2025-02-01 04:30:07 +01:00
parent ac1396304f
commit 99bb1555a0
5 changed files with 29 additions and 2 deletions

View File

@ -31,6 +31,17 @@ export const useMapStore = defineStore('map', {
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) {
character[property] = value
}
},
removeCharacter(characterId: UUID) {
this.characters = this.characters.filter((char) => char.character.id !== characterId)
},