Minor cleanup ActiveEffect
This commit is contained in:
parent
b27ff16857
commit
893f2aa835
@ -3502,8 +3502,10 @@ export class RdDActor extends Actor {
|
|||||||
const ids = Array.from(this.effects?.values())
|
const ids = Array.from(this.effects?.values())
|
||||||
.filter(it => it.data.flags.core?.statusId == id)
|
.filter(it => it.data.flags.core?.statusId == id)
|
||||||
.map(it => it.id);
|
.map(it => it.id);
|
||||||
|
if (ids.length > 0) {
|
||||||
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
this.deleteEmbeddedDocuments('ActiveEffect', ids);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
deleteStatusEffect(effect) {
|
deleteStatusEffect(effect) {
|
||||||
@ -3521,8 +3523,9 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addStatusEffect(statusEffect) {
|
async addStatusEffect(statusEffect) {
|
||||||
const effet = duplicate(statusEffect);
|
const effet = Misc.data(statusEffect);
|
||||||
this.deleteStatusEffectById(effet.id);
|
this.deleteStatusEffectById(effet.id);
|
||||||
|
effet.flags = effet.flags ?? { core: {} };
|
||||||
effet.flags.core.statusId = effet.id;
|
effet.flags.core.statusId = effet.id;
|
||||||
await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
await this.createEmbeddedDocuments('ActiveEffect', [effet]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user