pf2e icon indicating copy to clipboard operation
pf2e copied to clipboard

Updating shield HP is not immediately reflected in the token resource bar

Open ghost91- opened this issue 3 years ago • 0 comments

Shield HP can be used as a token resource and displayed as a bar. However, for linked tokens, when the shield HP is changed (e.g., via the character sheet), the resource bar is not updated immediately, but only once the token is hovered, or another similar interaction (e.g., reloading) is performed.

The reason is, that redrawing the bars is only triggered in the _onUpdate method of the Actor class in foundry core. Changing the shield HP however just changes the corresponding shield item, and thus does not cause the bars to be redrawn.

One way to solve it would be by also causing the bars to be redrawn when an owned shield item is changed. I have implemented this in one of my modules via the updateItem hook (https://github.com/ghost-fvtt/pf2-shields-token-bar/blob/main/modules/pf2-shields-token-bar.mjs#L90), but I think it should probably be done in pf2e directly instead.

I don't know that much about pf2e, but potentially, this could also affect other properties that are derived from items, which are usable in resources. In that case, it would probably make sense to extend the functionality to those kinds of items, too.

ghost91- avatar Oct 26 '22 11:10 ghost91-