Update removeTag to allow BOTH to be removed

Create handling for removal of either a specific side, or both sides.
This commit is contained in:
Stophles 2024-04-12 19:59:29 -05:00 committed by GitHub
parent 81f2d150a6
commit 87770dd439
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -518,7 +518,15 @@ export class Arena {
}
removeTag(tagType: ArenaTagType, side: ArenaTagSide = ArenaTagSide.BOTH): boolean {
const tags = this.tags;
const tags = this.tags
if(side == ArenaTagSide.BOTH){
tags.filter(t => (t.tagType == tagType)).forEach(t => {
t.onRemove(this);
tags.splice(tags.indexOf(t), 1);
})
return true;
}
else {
const tag = tags.find(t => t.tagType === tagType && t.side === side);
if (tag) {
tag.onRemove(this);
@ -526,6 +534,7 @@ export class Arena {
}
return !!tag;
}
}
removeAllTags(): void {
while (this.tags.length) {