Fix retrieving resource attribute bars in token

This commit is contained in:
Carlos Fernandez 2026-03-13 21:15:21 -04:00
parent 7d50ba409f
commit cfa3947fe8

View file

@ -82,6 +82,24 @@ class ResourcesField extends fields.TypedObjectField {
} }
return data; return data;
} }
/**
* Foundry bar attributes are unable to handle finding the schema field nor the label normally.
* This returns the element if its a valid resource key and overwrites the element's label for that retrieval.
*/
_getField(path) {
if ( path.length === 0 ) return this;
const first = path.shift();
if (first === this.element.name) return this.element_getField(path);
const resources = CONFIG.DH.RESOURCE[this.actorType].all;
if (first in resources) {
this.element.label = resources[first].label;
return this.element._getField(path);
}
return undefined;
}
} }
export { attributeField, ResourcesField, stressDamageReductionRule, bonusField }; export { attributeField, ResourcesField, stressDamageReductionRule, bonusField };