set system type to ikonis and scope feature IDs to item IDs to prevent duplicate sheet entries
This commit is contained in:
parent
378d25d29f
commit
5ac4a0af17
1 changed files with 8 additions and 4 deletions
|
|
@ -162,7 +162,13 @@ export function patchDhCharacter(DhCharacter) {
|
|||
if (feature) {
|
||||
// Use clone() to preserve internal action state
|
||||
const featureClone = feature.clone({ parent: this.parent }, { keepId: true });
|
||||
const virtualId = `ikonis-${feature.id}`;
|
||||
|
||||
// Set system type to 'ikonis' so the original sheetLists ignores it
|
||||
// This prevents features from appearing twice on the sheet
|
||||
featureClone.system.type = "ikonis";
|
||||
|
||||
// Use unique ID per weapon to prevent overwriting same-tech on different weapons
|
||||
const virtualId = `ikonis-${item.id}-${feature.id}`;
|
||||
Object.defineProperty(featureClone, "id", { value: virtualId, enumerable: true });
|
||||
|
||||
// ALWAYS inject into memory collection so it's resolvable
|
||||
|
|
@ -171,9 +177,7 @@ export function patchDhCharacter(DhCharacter) {
|
|||
// ONLY add to the sheet list if the weapon is equipped
|
||||
if (isEquipped) {
|
||||
ikonisFeatures.push(featureClone);
|
||||
console.log(`DH-Ikonis | Resolved ${type} feature: ${feature.name} (Equipped)`);
|
||||
} else {
|
||||
console.log(`DH-Ikonis | Resolved ${type} feature: ${feature.name} (Unequipped - Hidden from sheet)`);
|
||||
console.log(`DH-Ikonis | Resolved ${type} feature: ${feature.name} for ${item.name} (Equipped)`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue