From b1bde69a7d22424e3a48d2d8feae1584f8dc4a3b Mon Sep 17 00:00:00 2001 From: trotFunky Date: Tue, 10 Jun 2025 23:00:08 +0100 Subject: [PATCH] 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. --- README.md | 8 +++++--- lang/en.json | 2 +- lang/fr.json | 2 +- scripts/token_ui_adjust.mjs | 6 ++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 07ecad1..f63a1d1 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,12 @@ The module supports going back and forth in the combat rounds, as well as going ## 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. +Given that we add a border *on* the tokens, it conflicts with the base attribute bars and status effect indicators 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. +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 diff --git a/lang/en.json b/lang/en.json index 9a0f3ce..a6a782c 100644 --- a/lang/en.json +++ b/lang/en.json @@ -22,7 +22,7 @@ "Settings": { "Enabled": { "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." } } } diff --git a/lang/fr.json b/lang/fr.json index de723f1..3630ef7 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -22,7 +22,7 @@ "Settings": { "Enabled": { "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." } } } diff --git a/scripts/token_ui_adjust.mjs b/scripts/token_ui_adjust.mjs index 44af60e..bff8393 100644 --- a/scripts/token_ui_adjust.mjs +++ b/scripts/token_ui_adjust.mjs @@ -21,6 +21,8 @@ Hooks.once("setup", () => { /** Padding above and below the token, percentage of a grid square. */ 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) => { /* @@ -49,5 +51,9 @@ Hooks.once("setup", () => { base_refreshNameplate() 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); }) })