Implement Token UI adjustments

Implement the sub-module moving the attribute bars and nameplate
to work well with our dynamic borders.

The attribute bars are moved below the token, one on
top of the other, and the nameplate is moved above.

This is done by monkey patching the `_drawBar()` and
`_refreshNameplate()` functions from the Token class.
This is vulnerable to compatibility issues with other
modules, but is the only way I found for the changes
to be shown without further input.

Indeed, those functions are called after the `drawToken`
hook, which makes it impossible to move those UI elements
there.
We can do it in the `refreshToken` hook, which works *but*
requires the canvas view to be moved at least once for
the position change to be reflected, which looks a bit
broken.

So we monkey patch the functions, but bind them
beforehand to be able to call them within our custom
function as we don't want to duplicate what they do.

Update README and translations for the added setting.
This commit is contained in:
trotFunky 2025-06-01 18:37:18 +01:00
parent ab02dd139a
commit 22dc500801
4 changed files with 80 additions and 0 deletions

View file

@ -51,6 +51,19 @@ There are currently two main issues that need to be fixed :
and thus the border type, cannot be properly determined on scene switch.
- This can be fixed by receiving a combat update, either from the players or the GM, on the scene.
## Token UI adjustments
Given that we add a border *on* the tokens, it conflicts with the base attribute bars which are drawn over the token's
square.
The token UI adjustments move the two attribute bars below the token, outside its space, first HP then mana.
As this is where the nameplate of the token should be, move it above the token instead.
### Limitations
- The token's detailed UI when right-clicking will overlap the bars in their new positions (it already overlapped the name)
- The current implementation relies on monkey patching, which make it vulnerable to compatibility issues with
other modules manipulating the same methods.
# Compendia
- The only thing in the compendium pack is a macro automating the tinkerer's alchemy potions,