mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Made sure to load compendium document if it wasn't already (#501)
This commit is contained in:
parent
ab54edb47c
commit
3014be79ad
1 changed files with 14 additions and 9 deletions
|
|
@ -126,15 +126,20 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
|
|
||||||
if (this.actor && this.actor.type === 'character' && this.features) {
|
if (this.actor && this.actor.type === 'character' && this.features) {
|
||||||
for (let f of this.features) {
|
for (let f of this.features) {
|
||||||
const feature = f.item ?? f;
|
const fBase = f.item ?? f;
|
||||||
const createData = foundry.utils.mergeObject(feature.toObject(), {
|
const feature = fBase.system ? fBase : await foundry.utils.fromUuid(fBase.uuid);
|
||||||
system: {
|
const createData = foundry.utils.mergeObject(
|
||||||
originItemType: this.parent.type,
|
feature.toObject(),
|
||||||
originId: data._id,
|
{
|
||||||
identifier: feature.identifier,
|
system: {
|
||||||
subType: feature.item ? feature.type : undefined
|
originItemType: this.parent.type,
|
||||||
}
|
originId: data._id,
|
||||||
}, { inplace: false });
|
identifier: feature.identifier,
|
||||||
|
subType: feature.item ? feature.type : undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ inplace: false }
|
||||||
|
);
|
||||||
await this.actor.createEmbeddedDocuments('Item', [createData]);
|
await this.actor.createEmbeddedDocuments('Item', [createData]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue