From cfa3947fe8a22f76fb35d6d0e4bcd17fe84969b1 Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Fri, 13 Mar 2026 21:15:21 -0400 Subject: [PATCH] Fix retrieving resource attribute bars in token --- module/data/fields/actorField.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/data/fields/actorField.mjs b/module/data/fields/actorField.mjs index 1399fb32..76c24319 100644 --- a/module/data/fields/actorField.mjs +++ b/module/data/fields/actorField.mjs @@ -82,6 +82,24 @@ class ResourcesField extends fields.TypedObjectField { } 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 };