Skip to content

v1.0.0

Choose a tag to compare

@Azazel666 Azazel666 released this 21 Dec 13:29
· 5 commits to main since this release

[1.0.0]

Added

Core Features

  • Turn-Based Movement System: Complete turn-based token movement with permission-based control
  • Token Movement Restrictions: Players can only move their tokens during their turn, GMs have full override
  • Two Turn Order Modes:
    • Random order (shuffled)
    • Attribute-based order (highest value first)
  • Tiebreaker System: Optional secondary attribute to break ties in turn order
    • If tiebreaker is empty or still tied, uses random ordering for tied tokens

Visual Features

  • Turn Order UI Panel:
    • Draggable panel showing complete turn order with round counter
    • Current turn highlighted in green, next turn in yellow
    • Completed turns dimmed for visual feedback
    • Delayed tokens highlighted in orange with "(Delayed)" label
    • Click any token name to pan camera to it (if visible)
    • Panel remembers position across refreshes
  • Icon Indicators Above Tokens:
    • Green chevron (▼) for current turn
    • Yellow pause symbol (II) for next turn
    • Pulsing animation for visibility
    • Scaled appropriately (16px font)
    • Positioned 10 pixels above tokens

Turn Management Features

  • Round Counter: Automatic tracking starting at Round 1, increments when turn order completes
  • Pass Turn: Advance to the next token in order
    • GM can pass directly
    • Players send requests to GM via user flags
  • Delay Turn: Move current token to end of round
    • Can only delay once per round
    • Cannot delay if you're the last non-delayed token (unless others already delayed)
    • Delayed tokens act at end of round in their original order
    • Round increments after last delayed token acts
    • GM processes player delay requests via user flags
  • Reset Turn Order: Regenerate turn order and reset round to 1
  • Drag-and-Drop Reordering (GM only): Click and drag token names in UI panel to manually reorder permanently

Combat Integration

  • Auto-Disable on Combat Start: TBM automatically disables when combat begins
  • Auto-Resume After Combat: Optional setting to resume TBM when combat ends (if it was enabled before)
  • State Persistence: Remembers if TBM was enabled before combat for proper resume behavior

UI/UX Features

  • Draggable Turn Order Panel: Click and hold header to move panel anywhere, position is saved
  • Visual State Indicators:
    • Green highlight: Current turn
    • Yellow highlight: Next turn
    • Orange highlight: Delayed tokens
    • Dimmed: Completed turns this round
  • Camera Pan on Click: Click token names in panel to center camera on that token
  • Notification System:
    • Players notified when it's their turn (GM excluded from these notifications)
    • Players notified when they're up next
    • Notifications for enable/disable TBM (not chat messages)
    • Warnings for invalid actions (not your turn, can't delay, etc.)

Technical Features

  • Scene Flag Storage: All state persisted in scene flags
    • Turn order array
    • Current index
    • Current round
    • Delayed tokens list
    • Delayed this round list (prevents multiple delays)
  • User Flag Communication: Permission-safe player-to-GM communication via user flags
    • Pass turn requests
    • Delay turn requests
    • GM validates and processes all player requests
  • Permission-Based Security:
    • Players can only affect their own tokens
    • All state changes require GM or token ownership
    • Validation on both client and GM side

Module Settings

  • Enable Turn-Based Movement: Toggle system on/off
  • Turn Order Type: Random or By Token Attribute
  • Attribute Path: Primary attribute for turn order (e.g., system.attributes.init.value)
  • Tiebreaker Attribute Path: Optional secondary attribute for breaking ties
  • Show Visual Indicators: Enable/disable icon indicators above tokens
  • Resume After Combat: Automatically resume TBM when combat ends

Localization

  • Full English localization support
  • All UI strings externalized to lang/en.json
  • Strings for settings, controls, notifications, and UI labels

Compatibility

  • Foundry VTT: v11 minimum, verified up to v12
  • Game Systems: System-agnostic, works with all game systems
  • Module Compatibility: No known conflicts

Developer Features

  • Clean, documented code structure
  • Single-class design for maintainability
  • Static methods for easy access
  • Scene flag-based state management
  • Hook-based reactivity
  • PIXI.js for canvas rendering

Technical Implementation Details

Architecture

  • Client-Side Only: No server-side code required
  • Static Class Design: TurnBasedMovement class with static methods
  • Event-Driven: Uses Foundry hooks for reactivity
  • Flag-Based State: Scene and user flags for data storage

Key Files

  • scripts/turn-based-movement.js: Main module code
  • styles/turn-based-movement.css: UI styling
  • lang/en.json: English localization strings
  • module.json: Module manifest

Data Flow

  1. GM Actions: Directly modify scene flags
  2. Player Actions: Set user flags, GM watches updateUser hook and processes
  3. State Changes: Trigger updateScene hook, all clients refresh
  4. Visual Updates: refreshVisuals() called on state changes

Performance Optimizations

  • Panel position saved and restored on refresh (no flicker)
  • Icons only recreated when needed
  • Efficient token lookup via scene.tokens.get()
  • Minimal DOM manipulation

Known Limitations

  • Players require active GM connection to pass/delay turns (uses request system)
  • Turn order limited to tokens with linked actors
  • Single scene at a time (scene-specific state)