Get the item embedding working in a cleaner way where most of the item embedding logic is handled in the item's class instead of the actor's class

This commit is contained in:
Oliver-Akins 2024-03-22 20:23:28 -06:00
parent 0605542d62
commit 18cdc2addc
4 changed files with 20 additions and 48 deletions

View file

@ -1,9 +1,20 @@
import { DotDungeonItem } from "./GenericItem.mjs";
export class Aspect extends DotDungeonItem {
async _preCreate() {
async _preCreate(...args) {
if (this.isEmbedded) {
return await this.actor?.preItemEmbed(this);
if (this.actor.atAspectLimit) {
ui.notifications.error(
game.i18n.format(
`dotdungeon.notification.error.aspect-limit-reached`,
{ limit: game.settings.get(`dotdungeon`, `aspectLimit`) }
),
{ console: false }
);
return false;
};
return await this.actor?.preItemEmbed(...args);
};
}
};