ardittristan / 5eSheet-resourcesPlus

A module that allows you to add more resources to 5e character sheets
GNU General Public License v3.0
9 stars 5 forks source link

Additional resources are not editable through token HUD #21

Closed DJ4ddi closed 2 years ago

DJ4ddi commented 2 years ago

When using a resource that is not in the original model (fourth and above) as a token resource, the resulting input in the token's HUD is not editable.

Versions

Reproduction

  1. Create a token from an actor with at least 4 resources enabled.
  2. Open the token's HUD by right-clicking on it, then open the Token Configuration (cogwheel icon).
  3. Go to the "Resources" tab and set any attribute to "resources.fourth" (or any other additional resource).
  4. Click "Update Token" to save the configuration.
  5. Check the input that should now have appeared on the token HUD. Observe that it is not editable.

Cause The check that prevents editing this value is found on line 18803 in the foundry.js file:


const model = game.system.model.Actor[this.actor.type];
// ...
return {
  editable: foundry.utils.hasProperty(model, `${attr}.value`)
}

Essentially, FoundryVTT checks if the attribute is part of the unmodified actor model in order to determine whether the resource should be editable, which is unfortunately not the intended result in this case.