fix: make it possible to add embedded effects/items to items and actors in packs

This commit is contained in:
Johannes Loher 2021-09-22 02:34:50 +02:00
parent 756c512c20
commit bdea7de7f3
3 changed files with 5 additions and 8 deletions

View file

@ -95,14 +95,11 @@ export class DS4ActiveEffect extends ActiveEffect {
* @param context The context for the creation of the effect, requiring a parent {@link DS4Actor} or {@link DS4Item}.
* @returns A promise that resolved to the created effect or udifined of the creation was prevented.
*/
static async createDefault(
context: DocumentModificationContext & { parent: DS4Actor | DS4Item },
): Promise<DS4ActiveEffect | undefined> {
static async createDefault(parent: DS4Actor | DS4Item): Promise<DS4ActiveEffect[]> {
const createData = {
label: getGame().i18n.localize(`DS4.NewEffectLabel`),
icon: this.FALLBACK_ICON,
};
return this.create(createData, context);
return parent.createEmbeddedDocuments("ActiveEffect", [createData]) as Promise<DS4ActiveEffect[]>;
}
}