mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Fixed removal of itemLinks from 'owning' item
This commit is contained in:
parent
6a7f19363d
commit
f5ecaa3c50
1 changed files with 22 additions and 0 deletions
|
|
@ -190,5 +190,27 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.features?.length) {
|
||||
for (let feature of this.features) {
|
||||
await feature.update({
|
||||
'system.itemLinks': Object.keys(feature.system.itemLinks).reduce((acc, type) => {
|
||||
acc[type] = feature.system.itemLinks[type].filter(uuid => uuid !== this.parent.uuid);
|
||||
return acc;
|
||||
}, {})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (this.linkedItems?.length) {
|
||||
for (let item of this.linkedItems) {
|
||||
await item.update({
|
||||
'system.itemLinks': Object.keys(item.system.itemLinks).reduce((acc, type) => {
|
||||
acc[type] = item.system.itemLinks[type].filter(uuid => uuid !== this.parent.uuid);
|
||||
return acc;
|
||||
}, {})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue