Skip to content

fix(HealthColors): HealthColors v2.1.4: external HP sync fixes, legacy API compatibility, and bootstrap cleanup#2256

Open
steverobertsuk wants to merge 7 commits into
Roll20:masterfrom
steverobertsuk:sr/healthcolors-v2-1-4
Open

fix(HealthColors): HealthColors v2.1.4: external HP sync fixes, legacy API compatibility, and bootstrap cleanup#2256
steverobertsuk wants to merge 7 commits into
Roll20:masterfrom
steverobertsuk:sr/healthcolors-v2-1-4

Conversation

@steverobertsuk

Copy link
Copy Markdown
Contributor

HealthColors v2.1.4

This PR finalizes HealthColors v2.1.4 with a focus on reliability when HP is changed by other scripts, backwards compatibility for integrations, and cleanup of public exports.

What is fixed

  • Fixed missed updates when external scripts (like AlterBars) change linked character HP attributes instead of token bars.
  • Added a dedicated change:attribute flow to capture real old/new HP values and correctly re-run token visuals.
  • Prevented duplicate FX when both change:attribute and change:graphic fire for the same HP change.
  • Fixed TokenMod observer wiring to use the deduplicating token-change handler.
  • Fixed a race condition in delayed attribute-to-token propagation logic that could overwrite newer HP values.
  • Fixed add:graphic event handling and added a safe null guard for delayed token lookup.

Compatibility improvements

  • Restored legacy public API aliases from v1.7.1 while keeping v2 camelCase methods.

HealthColors now exposes both:

  • gmWhisper and GMW

  • update and Update

  • checkInstall and CheckInstall

  • registerEventHandlers and RegisterEventHandlers

  • Hardened external previous-value reads to support both object snapshots and get(...) style access.

  • If the previous HP is missing or invalid, HealthColors still updates:

    • Tint
    • Aura
    • Name visibility
    • Dead marker

    Only delta-based FX and death transition comparisons are skipped.

Impact

  • No user command syntax changes.
  • No settings behaviour changes.
  • No required changes for PowerCards, AlterBars, or existing scripts calling legacy HealthColors API names.

…plied prettier formatting

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
…or external scripts

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
…P change detection

Restore legacy API aliases (e.g., `GMW`, `Update`) for broader compatibility with older scripts.
Enhance previous token state handling to tolerate both Roll20 objects and JSON snapshots.
Refine HP change detection to allow visual updates (auras, tints, dead status) even when
previous HP values are invalid, while correctly gating particle effects and death sounds
to only fire on reliable HP deltas.

Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Signed-off-by: Steve Roberts <steve@shadowcomputers.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant