mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Merged with main
This commit is contained in:
commit
f0a809266d
70 changed files with 1245 additions and 881 deletions
|
|
@ -23,6 +23,23 @@ export default class DhpActor extends Actor {
|
|||
return this.system.metadata.isNPC;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
getEmbeddedDocument(embeddedName, id, options) {
|
||||
let doc;
|
||||
switch (embeddedName) {
|
||||
case 'Action':
|
||||
doc = this.system.actions?.get(id);
|
||||
if (!doc && this.system.attack?.id === id) doc = this.system.attack;
|
||||
break;
|
||||
default:
|
||||
return super.getEmbeddedDocument(embeddedName, id, options);
|
||||
}
|
||||
if (options?.strict && !doc) {
|
||||
throw new Error(`The key ${id} does not exist in the ${embeddedName} Collection`);
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
|
||||
async _preCreate(data, options, user) {
|
||||
if ((await super._preCreate(data, options, user)) === false) return false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue