Changed ItemLinksField makeup

This commit is contained in:
WBHarry 2025-07-23 14:50:24 +02:00
parent 600c08cb23
commit 30f31e77dd
13 changed files with 120 additions and 96 deletions

View file

@ -171,18 +171,18 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
);
}
if (this.metadata.isItemLinkable) {
const linkEntries = Object.entries(this.itemLinks);
for (let [uuid, type] of linkEntries) {
const item = await foundry.utils.fromUuid(uuid);
const path = CONFIG.DH.ITEM.itemLinkFeatureTypes[type] ? 'system.features' : 'system.linkedItems';
await item.update({
[path]: foundry.utils
.getProperty(item, path)
.filter(x => x.uuid !== this.parent.uuid)
.map(x => x.uuid)
});
}
}
// if (this.metadata.isItemLinkable) {
// const linkEntries = Object.entries(this.itemLinks);
// for (let [uuid, type] of linkEntries) {
// const item = await foundry.utils.fromUuid(uuid);
// const path = CONFIG.DH.ITEM.itemLinkFeatureTypes[type] ? 'system.features' : 'system.linkedItems';
// await item.update({
// [path]: foundry.utils
// .getProperty(item, path)
// .filter(x => x.uuid !== this.parent.uuid)
// .map(x => x.uuid)
// });
// }
// }
}
}