refactor: improve embedded document creation
This commit is contained in:
parent
eb2bbe1282
commit
8f3a72a7f4
2 changed files with 5 additions and 4 deletions
|
@ -92,14 +92,15 @@ export class DS4ActiveEffect extends ActiveEffect {
|
|||
/**
|
||||
* Create a new {@link DS4ActiveEffect} using default data.
|
||||
*
|
||||
* @param context The context for the creation of the effect, requiring a parent {@link DS4Actor} or {@link DS4Item}.
|
||||
* @param parent The parent {@link DS4Actor} or {@link DS4Item} of the effect.
|
||||
* @returns A promise that resolved to the created effect or udifined of the creation was prevented.
|
||||
*/
|
||||
static async createDefault(parent: DS4Actor | DS4Item): Promise<DS4ActiveEffect[]> {
|
||||
static async createDefault(parent: DS4Actor | DS4Item): Promise<DS4ActiveEffect | undefined> {
|
||||
const createData = {
|
||||
label: getGame().i18n.localize(`DS4.NewEffectLabel`),
|
||||
icon: this.FALLBACK_ICON,
|
||||
};
|
||||
return parent.createEmbeddedDocuments("ActiveEffect", [createData]) as Promise<DS4ActiveEffect[]>;
|
||||
|
||||
return this.create(createData, { parent, pack: parent.pack ?? undefined });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue