Fixed base resources getting their values capped to max at prepareDerivedData. Fixed effect autocomplete not having labels for baseResources.

This commit is contained in:
WBHarry 2026-03-25 17:07:20 +01:00
parent d258478218
commit a4fff56461
3 changed files with 16 additions and 7 deletions

View file

@ -83,19 +83,20 @@ 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;
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);
const field = this.element._getField(path);
field.label = resources[first].label;
return field;
}
return undefined;