mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Fixed action deletion unregistration
This commit is contained in:
parent
0b2241076c
commit
650043f06a
1 changed files with 22 additions and 0 deletions
|
|
@ -227,6 +227,28 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
const armorData = getScrollTextData(this.parent.parent.system.resources, changed.system.marks, 'armor');
|
const armorData = getScrollTextData(this.parent.parent.system.resources, changed.system.marks, 'armor');
|
||||||
options.scrollingTextData = [armorData];
|
options.scrollingTextData = [armorData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed.system?.actions) {
|
||||||
|
const triggersToRemove = Object.keys(changed.system.actions).reduce((acc, key) => {
|
||||||
|
if (!changed.system.actions[key]) {
|
||||||
|
const strippedKey = key.replace('-=', '');
|
||||||
|
acc.push(...this.actions.get(strippedKey).triggers.map(x => x.trigger));
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
game.system.registeredTriggers.unregisterTriggers(triggersToRemove, this.parent.uuid);
|
||||||
|
|
||||||
|
if (!(this.parent.parent.token instanceof game.system.api.documents.DhToken)) {
|
||||||
|
for (const token of this.parent.parent.getActiveTokens()) {
|
||||||
|
game.system.registeredTriggers.unregisterTriggers(
|
||||||
|
triggersToRemove,
|
||||||
|
`${token.document.uuid}.${this.parent.uuid}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onUpdate(changed, options, userId) {
|
_onUpdate(changed, options, userId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue