mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 04:01:06 +01:00
FEAT: add baseDataModel logic
This commit is contained in:
parent
746e0f239a
commit
70d8f37d3c
7 changed files with 254 additions and 7 deletions
|
|
@ -1,6 +1,12 @@
|
|||
export default class DhpItem extends Item {
|
||||
prepareData() {
|
||||
super.prepareData();
|
||||
/** @inheritdoc */
|
||||
getEmbeddedDocument(embeddedName, id, { invalid = false, strict = false } = {}) {
|
||||
const systemEmbeds = this.system.constructor.metadata.embedded ?? {};
|
||||
if (embeddedName in systemEmbeds) {
|
||||
const path = `system.${systemEmbeds[embeddedName]}.${id}`;
|
||||
return foundry.utils.getProperty(this, path) ?? null;
|
||||
}
|
||||
return super.getEmbeddedDocument(embeddedName, id, { invalid, strict });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -27,10 +33,6 @@ export default class DhpItem extends Item {
|
|||
return ['weapon', 'armor', 'miscellaneous', 'consumable'].includes(this.type);
|
||||
}
|
||||
|
||||
_onUpdate(data, options, userId) {
|
||||
super._onUpdate(data, options, userId);
|
||||
}
|
||||
|
||||
static async createDialog(data = {}, { parent = null, pack = null, ...options } = {}) {
|
||||
const documentName = this.metadata.name;
|
||||
const types = game.documentTypes[documentName].filter(t => t !== CONST.BASE_DOCUMENT_TYPE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue