UI: Move the status effect indicators to the right

As the token square is already busy due to the border, the
status effect indicators get hidden.
Move them entirely to the right of the token, so they don't
conflict anymore.

Do it only for PCs, as NPC tokens do not have the border and
the GM will probably have their token UI open more often, which
would hide the status effect indicators.
This commit is contained in:
trotFunky 2025-06-10 23:00:08 +01:00
parent 3914c979b2
commit b1bde69a7d
4 changed files with 13 additions and 5 deletions

View file

@ -38,10 +38,12 @@ The module supports going back and forth in the combat rounds, as well as going
## Token UI adjustments ## 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 Given that we add a border *on* the tokens, it conflicts with the base attribute bars and status effect indicators which
square. 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. 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. As this is where the nameplate of the token should be, move it above the token instead.
The status effect indicators are moved entirely outside the token space as well, to the right, but as it is not useful
for NPCs this is only done for PC tokens.
### Limitations ### Limitations

View file

@ -22,7 +22,7 @@
"Settings": { "Settings": {
"Enabled": { "Enabled": {
"Name": "Token UI adjustments", "Name": "Token UI adjustments",
"Hint": "Moves both attribute bars below the token and the nameplate above." "Hint": "Moves both attribute bars below the token, the nameplate above and, for PCs, the status icons to the right."
} }
} }
} }

View file

@ -22,7 +22,7 @@
"Settings": { "Settings": {
"Enabled": { "Enabled": {
"Name": "Ajustements d'interface des tokens", "Name": "Ajustements d'interface des tokens",
"Hint": "Déplace les barres d'attributs sous le token et le nom au dessus." "Hint": "Déplace les barres d'attributs sous le token, le nom au dessus et, pour les PJs, les indicateurs de statut à droite."
} }
} }
} }

View file

@ -21,6 +21,8 @@ Hooks.once("setup", () => {
/** Padding above and below the token, percentage of a grid square. */ /** Padding above and below the token, percentage of a grid square. */
const top_bot_padding = 5; const top_bot_padding = 5;
/** Padding left and right the token, percentage of a grid square. */
const left_right_padding = 5;
Hooks.on("drawToken", (drawn_token) => { Hooks.on("drawToken", (drawn_token) => {
/* /*
@ -49,5 +51,9 @@ Hooks.once("setup", () => {
base_refreshNameplate() base_refreshNameplate()
drawn_token.nameplate.position.set(token_width/2, -(padding + drawn_token.nameplate.height)) drawn_token.nameplate.position.set(token_width/2, -(padding + drawn_token.nameplate.height))
} }
if (drawn_token.document.hasPlayerOwner)
drawn_token.effects.position.x += drawn_token.getSize().width +
drawn_token.scene.grid.size * (left_right_padding/100);
}) })
}) })