simplify augment system to resolve features dynamically via native configuration instead of manual synchronization

This commit is contained in:
CPTN Cosmo 2026-04-26 19:00:08 +02:00
parent 01fc302b43
commit e21e66d6c2
4 changed files with 40 additions and 221 deletions

View file

@ -49,11 +49,11 @@ export function patchIkonisSheet() {
const processedAugments = [];
for (const featureRef of weaponFeatures) {
const id = featureRef.value;
const base = allAugmentsList.find(a => String(a.id) === String(id));
const nativeId = featureRef.value;
const base = allAugmentsList.find(a => String(a.id) === String(nativeId));
if (!base) continue;
const aug = { ...base, installed: true };
processedAugments.push(aug);
processedAugments.push({ ...base, installed: true });
}
const bondedUuid = doc.getFlag('dh-ikonis', 'bondedFeatureUuid') || game.settings.get('dh-ikonis', 'defaultBondedUuid');
@ -169,7 +169,8 @@ export function patchIkonisSheet() {
Weapon.prototype._onRemoveAugment = async function(event, target) {
const weaponFeatures = this.document.system.weaponFeatures || [];
const newFeatures = weaponFeatures.filter(f => f.value !== String(target.dataset.id));
const targetId = target.dataset.id;
const newFeatures = weaponFeatures.filter(f => f.value !== targetId);
await this.document.update({ "system.weaponFeatures": newFeatures });
this.render(true);
};