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
|
|
@ -202,7 +202,8 @@
|
|||
"invalid-socket": "Invalid socket data received, this means a module or system bug is present.",
|
||||
"unknown-socket-event": "An unknown socket event was received: {event}",
|
||||
"no-active-gm": "No active @USER.GM is logged in, you must wait for a @USER.GM to be active before you can do that.",
|
||||
"malformed-socket-payload": "Socket event \"{event}\" received with malformed payload. Details: {details}"
|
||||
"malformed-socket-payload": "Socket event \"{event}\" received with malformed payload. Details: {details}",
|
||||
"invalid-parent-document": "Cannot create an item with type \"{itemType}\" on a parent document of type \"{parentType}\""
|
||||
},
|
||||
"warn": {
|
||||
"cannot-go-negative": "\"{name}\" is unable to be a negative number."
|
||||
|
|
|
|||
|
|
@ -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