Shadows Hud

Release Notes v0.1.0

Released: 2026-08-26
Foundry VTT: v14
Author: shadows_plays

Changelog & Notes

🚀 Added & Enhanced Features

  • Dynamic Sound Effects Integration (AudioService):
  • Built AudioService with safe cross-version Foundry audio helper resolution (foundry.audio.AudioHelper, game.audio, and HTML5 Audio fallback).
  • Integrated sound effects for Weapon Selection (gun cocking/draw), Spell Selection (magic charge/arcane hum), and Ranged/Melee Attacks.
  • SR5 Schema & Subcategory Recognition: Automatically inspects raw stored keys (sys.subcategory) and model names across both English and German SR5 schemas (e.g. Schrotflinte / shotgun, Pistole, Sturmgewehr, Maschinenpistole, Scharfschützengewehr, Klinge).
  • Exact Dice Roll Timing: Syncs audio playback with dice roll completion (DiceSoNice 3D dice completion hook or 600ms roll delay), preventing dice clattering sounds from masking audio.
  • Pending Roll Item Tracking: Records the exact weapon used on crosshair attack clicks so the matching sound plays upon roll completion.
  • 300ms Debounce & 1.2s Duration Limit: Prevents duplicate sound triggers and caps playback duration to 1.2s max for crisp UI responsiveness.
  • Declared soft module recommendations (recommends) in src/module.json for gAudioBundle-1, gAudioBundle-2, gAudioBundle-3, and gAudioBundle-4, with quiet fallback to silence if inactive.
  • GM Target Token Lock & Persistence (targetLocked):
  • Added GM-only Target Lock toggle button (.shadows-hud-target-lock-btn) on the top-left of the character avatar frame, controlling global scene token targeting behavior.
  • Persisted targetLocked state cleanly as a client setting object { enabled: boolean }, seamlessly persisting across scene reloads (F5).
  • When Target Lock is Active ({ enabled: true }): Right-clicking enemy/NPC tokens on canvas opens a Pure Attack HUD (all standard Foundry controls stripped) displaying a single red crosshairs target button for the locked attacker's in-hand weapon/spell.
  • When Target Lock is Disabled ({ enabled: false }): Right-clicking tokens on canvas opens standard Foundry Token HUD controls for GM (no attack button).
  • Explicit left-clicking any token on canvas updates shadows-hud's bound actor.
  • Automatically reloads actor actions and syncs weapon ammunition state across the HUD following attack rolls.
  • Left-Anchored Expand-Right Layout:
  • Anchored #shadows-hud-root to left: 80px.
  • When no token is selected, displays compact Standalone Macro Bar.
  • When a token is selected, HUD expands left-to-right (PortraitEquipment Set SlotActionsRound Controls), resolving right sidebar canvas clipping.
  • Expanded HUD Height:
  • Expanded .shadows-hud-main-bar min-height to 90px for clear visual breathing room across macro grids and 3-line cards.
  • Unified Equipment Set Slot Position Sharing:
  • Weapons, Spells, and Matrix panels share a single position in _panelOrder.
  • Moving matrix or spells to a new slot position automatically updates weapons to open in that exact same moved position.
  • Top-Edge Height Alignment:
  • Standardized .shadows-section-body-row (align-items: flex-start) and .shadows-hud-actions-panel (justify-content: flex-start).
  • All section card headers, category tabs, and controls start flush at the exact same top vertical line.
  • Enhanced 3-Line Weapon Card:
  • Structured 3-line layout: Row 1 (Icon, Name, Caret [v]), Row 2 (Vector SVG Firemode Icons), Row 3 (Ammo stats).
  • Overlaid top-left [IN HAND] badge.
  • Implemented extractPrimitiveNumber in ActionService.js to unwrap nested SR5e ammo objects ({ value: { value: 7 } }), resolving [object Object] rendering.
  • Contextual In-Place Selection Popup:
  • Relocated weapon-select-popup.hbs to render directly inside set containers (weapon-sets.hbs, magic-sets.hbs, matrix-sets.hbs) anchored at bottom: calc(100% + 14px); left: 0;.
  • The selection window always spawns 100% directly above the active set slot position wherever it is dragged.
  • Left-clicking any item in the popup arms it into the In-Hand slot and automatically closes the popup window.
  • Implemented 250ms timestamp debounce guard to prevent double-toggling on right clicks.
  • Relocated Macro Utility Icons:
  • Moved Macro Lock, Open Directory, and Clear Macro icons UP into .shadows-section-top-header of the Actions panel when activeTab === 'macros'.
  • Macro slot grid is now 100% unobstructed.
  • Interactive Drag & Drop Indicators:
  • Dragged columns receive red dashed cyberpunk contour (shadows-panel-dragging).
  • Target drop columns receive glowing yellow dashed cyberpunk contour (shadows-panel-drop-target).
  • Dynamic Foundry Light / Dark Theme Support:
  • Created ThemeHelper.js with real-time MutationObserver on document.body.
  • Automatically switches between Cyberpunk Dark (theme-dark) and Foundry Light (theme-light) modes based on Foundry VTT settings.

🛠️ Codebase & Architectural Refactoring

  • Decoupled ShadowsHudApp Package Architecture (src/scripts/apps/shadowHud/):
  • Relocated monolithic ShadowsHudApp.js into its own dedicated package directory (src/scripts/apps/shadowHud/).
  • Separated responsibilities into focused classes:
    • ShadowsHudDataLoader: Data fetching, system track pips, macro mapping, and panel ordering calculations (get).
    • ShadowsHudEventHandler: DOM event binding, macro drag-and-drop, skill rolls, and combat controls (do).
    • ShadowsHudState: State lifecycle, active actor/token bindings, panel visibility, and section mutations (update).
    • ShadowsHudApp: Light orchestrator app shell delegating to loader, handler, and state.
  • Modular Barrel Exporters & Namespace Imports (module.mjs):
  • Created module.mjs barrel files across all script directories (services/, apps/, apps/shadowHud/, API/, canvas/, components/).
  • Refactored imports across the codebase to use standard ES namespace imports (import * as services from ".../services/module.mjs" and services.ActionService).
  • Scoped CSS Cleanliness:
  • Refactored CSS to use high-specificity scoped rules under #shadows-hud-root and #hud, eliminating 25+ non-essential !important flags.