Prevent creating a Trait when it's on a non-geist Actor
This commit is contained in:
parent
0e0f9d3831
commit
4d0f29d7f0
2 changed files with 21 additions and 2 deletions
|
|
@ -1,11 +1,29 @@
|
|||
import { localizer } from "../../utils/Localizer.mjs";
|
||||
|
||||
const { fields } = foundry.data;
|
||||
|
||||
export class TraitData extends foundry.abstract.TypeDataModel {
|
||||
// #region Schema
|
||||
static defineSchema() {
|
||||
return {
|
||||
description: fields.HTMLField({ blank: true, nullable: false, trim: true }),
|
||||
description: new fields.HTMLField({ blank: true, nullable: false, trim: true }),
|
||||
};
|
||||
};
|
||||
// #endregion Schema
|
||||
|
||||
// #region Lifecycle
|
||||
async _preCreate() {
|
||||
if (this.parent.isEmbedded && this.parent.parent.type !== `geist`) {
|
||||
ui.notifications.error(localizer(
|
||||
`RipCrypt.notifs.error.invalid-parent-document`,
|
||||
{ itemType: `trait`, parentType: this.parent.parent.type },
|
||||
));
|
||||
return false;
|
||||
};
|
||||
};
|
||||
// #endregion
|
||||
|
||||
async getFormFields() {
|
||||
return [];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue