From 8e92d2636e073fcda1139077e6efeb65c402e85a Mon Sep 17 00:00:00 2001 From: Joe Nosie <182554+BoltsJ@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:33:35 -0500 Subject: [PATCH] Improve combat tracker buttons Only show buttons for available activations and make the deactivation button a different icon. Also improve the brightness of the deactivate button. Add an icon display next to the controls for max activations --- public/lang/en.json | 9 ++++- public/templates/combat/combat-tracker.hbs | 6 ++- .../combat/lancer-initiative-settings.hbs | 5 +++ src/global.d.ts | 1 + src/lancer.scss | 37 +++++++++++++++++-- src/module/combat/lancer-combat-tracker.ts | 4 +- src/module/settings.ts | 3 +- 7 files changed, 57 insertions(+), 8 deletions(-) diff --git a/public/lang/en.json b/public/lang/en.json index f0aefa0af..39aa7c26e 100644 --- a/public/lang/en.json +++ b/public/lang/en.json @@ -28,6 +28,11 @@ } }, "lancer": { + "Actor": { + "FIELDS": { + "activations": { "label": "Activations" } + } + }, "placeholder": { "name": "Name" }, @@ -380,6 +385,8 @@ "IconSettingsMenu": "Icon Settings", "Icon": "Action Icon", "IconDesc": "CSS classes to define the activation icon.", + "DeactivateIcon": "Deactivation Icon", + "DeactivateIconDesc": "CSS classes to define the deactivation icon.", "IconSize": "Icon Size", "IconPreview": "Icon Preview", "PCColor": "Player Color", @@ -391,7 +398,7 @@ "EnemyColor": "Enemy Color", "EnemyColorDesc": "Default: #d98f30", "DoneColor": "Inactive Color", - "DoneColorDesc": "Default: #444444", + "DoneColorDesc": "Default: #aaaaaa", "ActivatedLast": "Activated Units Last", "ActivatedLastDesc": "Moves units that have taken their turn to the end of the tracker.", "SortTracker": "Sort the Tracker", diff --git a/public/templates/combat/combat-tracker.hbs b/public/templates/combat/combat-tracker.hbs index 3f2cc2bfe..1ab74640c 100644 --- a/public/templates/combat/combat-tracker.hbs +++ b/public/templates/combat/combat-tracker.hbs @@ -86,6 +86,10 @@ {{/if}} + + + {{this.activations}} +
{{#each this.effects}} @@ -105,7 +109,7 @@ {{/lancerinitiative-repeat}} {{#lancerinitiative-repeat this.finished}} - + {{/lancerinitiative-repeat}}
diff --git a/public/templates/combat/lancer-initiative-settings.hbs b/public/templates/combat/lancer-initiative-settings.hbs index a589d31d1..2e9f0b46b 100644 --- a/public/templates/combat/lancer-initiative-settings.hbs +++ b/public/templates/combat/lancer-initiative-settings.hbs @@ -5,6 +5,11 @@

{{ localize "LANCERINITIATIVE.IconDesc" }}

+
+ + +

{{ localize "LANCERINITIATIVE.DeactivateIconDesc" }}

+
diff --git a/src/global.d.ts b/src/global.d.ts index 766a8997d..439fba2ae 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -19,6 +19,7 @@ interface LancerInitiativeConfig { */ def_appearance?: { icon: string; + deactivate: string; icon_size: number; player_color: string; friendly_color: string; diff --git a/src/lancer.scss b/src/lancer.scss index 8f6b3ff06..a5baa6913 100644 --- a/src/lancer.scss +++ b/src/lancer.scss @@ -2748,15 +2748,32 @@ Here, this means we want to allow for drag stuff etc to show contextually if: flex: 0 0 auto; } + .combatant-controls { + span.activations { + flex: 0 0 20px; + display: flex; + justify-content: center; + align-items: center; + font-size: 20px; + i { + color: var(--color-text-dark-5); + font-size: 20px; + position: absolute; + } + span { + flex: 0; + font-size: 14px; + position: relative; + opacity: 0.8; + } + } + } + .token-initiative { i, a { font-size: var(--lancer-initiative-icon-size); } - - i.done { - color: var(--lancer-initiative-done-color); - } } } @@ -2765,6 +2782,9 @@ Here, this means we want to allow for drag stuff etc to show contextually if: .token-initiative a { color: var(--lancer-initiative-player-color); + &.done { + color: var(--lancer-initiative-done-color); + } } } .combatant.friendly { @@ -2772,6 +2792,9 @@ Here, this means we want to allow for drag stuff etc to show contextually if: .token-initiative a { color: var(--lancer-initiative-friendly-color); + &.done { + color: var(--lancer-initiative-done-color); + } } } .combatant.neutral { @@ -2779,6 +2802,9 @@ Here, this means we want to allow for drag stuff etc to show contextually if: .token-initiative a { color: var(--lancer-initiative-neutral-color); + &.done { + color: var(--lancer-initiative-done-color); + } } } .combatant.enemy { @@ -2786,6 +2812,9 @@ Here, this means we want to allow for drag stuff etc to show contextually if: .token-initiative a { color: var(--lancer-initiative-enemy-color); + &.done { + color: var(--lancer-initiative-done-color); + } } } } diff --git a/src/module/combat/lancer-combat-tracker.ts b/src/module/combat/lancer-combat-tracker.ts index e88be7f66..ae4cc0d55 100644 --- a/src/module/combat/lancer-combat-tracker.ts +++ b/src/module/combat/lancer-combat-tracker.ts @@ -50,8 +50,9 @@ export class LancerCombatTracker extends CombatTracker { return { ...t, css: t.css + " " + disp[combatant?.disposition ?? -2], + activations: combatant?.activations.max, pending: combatant?.activations.value ?? 0, - finished: (combatant?.activations.max ?? 1) - (combatant?.activations.value ?? 0), + finished: +(this.viewed!.combatant === combatant), }; }); if (sort) { @@ -65,6 +66,7 @@ export class LancerCombatTracker extends CombatTracker { }); } data.icon_class = appearance.icon; + data.deactivate_icon_class = appearance.deactivate; data.enable_initiative = CONFIG.LancerInitiative.enable_initiative ?? false; return data; } diff --git a/src/module/settings.ts b/src/module/settings.ts index 6e0d08b73..8b176a10c 100644 --- a/src/module/settings.ts +++ b/src/module/settings.ts @@ -163,12 +163,13 @@ export const registerSettings = function () { templatePath: `systems/${game.system.id}/templates/combat/combat-tracker.hbs`, def_appearance: { icon: "cci cci-activate", + deactivate: "cci cci-deactivate", icon_size: 2, player_color: "#44abe0", friendly_color: "#44abe0", neutral_color: "#146464", enemy_color: "#d98f30", - done_color: "#444444", + done_color: "#aaaaaa", }, activations: "system.activations", };