fix: make it possible to add embedded effects/items to items and actors in packs
This commit is contained in:
parent
756c512c20
commit
bdea7de7f3
3 changed files with 5 additions and 8 deletions
|
@ -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[]>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
|
|||
type: type,
|
||||
data: data,
|
||||
};
|
||||
Item.create(itemData, { parent: this.actor });
|
||||
this.actor.createEmbeddedDocuments("Item", [itemData]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -205,7 +205,7 @@ export class DS4ActorSheet extends ActorSheet<ActorSheet.Options, DS4ActorSheetD
|
|||
* @param event - The originating click event
|
||||
*/
|
||||
protected onCreateEffect(): void {
|
||||
DS4ActiveEffect.createDefault({ parent: this.actor });
|
||||
DS4ActiveEffect.createDefault(this.actor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -99,7 +99,7 @@ export class DS4ItemSheet extends ItemSheet<ItemSheet.Options, DS4ItemSheetData>
|
|||
* Create a new ActiveEffect for the item using default data.
|
||||
*/
|
||||
protected createActiveEffect(): void {
|
||||
DS4ActiveEffect.createDefault({ parent: this.item });
|
||||
DS4ActiveEffect.createDefault(this.item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue