mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +01:00
Fixed Feature level unregistration
This commit is contained in:
parent
6f4ed1d6d9
commit
0b2241076c
5 changed files with 164 additions and 152 deletions
|
|
@ -105,7 +105,13 @@ export default class DhpActor extends Actor {
|
|||
}
|
||||
|
||||
async _preDelete() {
|
||||
game.system.registeredTriggers.unregisterItemTriggers(this.items);
|
||||
if (this.prototypeToken.actorLink) {
|
||||
game.system.registeredTriggers.unregisterItemTriggers(this.items);
|
||||
} else {
|
||||
for (const token of this.getActiveTokens()) {
|
||||
game.system.registeredTriggers.unregisterItemTriggers(token.actor.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_onDelete(options, userId) {
|
||||
|
|
|
|||
|
|
@ -213,10 +213,15 @@ export default class DHItem extends foundry.documents.Item {
|
|||
const actions = Array.from(this.system.actions ?? []);
|
||||
if (!actions.length) return;
|
||||
|
||||
game.system.registeredTriggers.unregisterTriggers(
|
||||
actions.flatMap(action => action.triggers.map(x => x.trigger)),
|
||||
this.uuid
|
||||
);
|
||||
const triggerKeys = actions.flatMap(action => action.triggers.map(x => x.trigger));
|
||||
|
||||
game.system.registeredTriggers.unregisterTriggers(triggerKeys, this.uuid);
|
||||
|
||||
if (!(this.actor.parent instanceof game.system.api.documents.DhToken)) {
|
||||
for (const token of this.actor.getActiveTokens()) {
|
||||
game.system.registeredTriggers.unregisterTriggers(triggerKeys, `${token.document.uuid}.${this.uuid}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async _preDelete() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue