diff --git a/README.md b/README.md new file mode 100644 index 0000000..0f257d4 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Daggerheart Countdowns Plus + +A simple module for the **Daggerheart** system on Foundry VTT that improves the usability of the countdown tracker. + +## Features + +- **Detachable Tracker**: Adds a "Detach" button to the default systems countdown/fear tracker. +- **Movable Window**: The detached tracker opens in its own window that can be dragged anywhere on the screen, minimizing obstruction of the game canvas. +- **System Tracker Integration**: While the detached tracker is open, the default system tracker (pinned to the top right) is hidden to avoid clutter. Closing the detached tracker automatically restores the system tracker. + +## Installation + +1. Open the Foundry VTT Setup screen. +2. Go to **Add-on Modules**. +3. Click **Install Module**. +4. Search for "Daggerheart Countdowns Plus" or paste the manifest URL. +5. Click **Install**. + +## Usage + +1. Open a world with the **Daggerheart** system. +2. Enable the **Daggerheart Countdowns Plus** module in **Game Settings** > **Manage Modules**. +3. Look for the "Detach" icon (an arrow pointing out of a square) in the header of the standard Countdown/Fear tracker. +4. Click it to pop out the tracker into a movable window. diff --git a/module.json b/module.json index d85be43..9e0999d 100644 --- a/module.json +++ b/module.json @@ -4,12 +4,16 @@ "description": "A module to allow the Daggerheart countdown tracker to be detached and moved freely.", "version": "1.0.0", "compatibility": { - "minimum": "12", - "verified": "12" + "minimum": "13", + "verified": "13" }, "authors": [ { - "name": "Antigravity" + "name": "CPTN Cosmo", + "email": "cptncosmo@gmail.com", + "url": "https://github.com/cptn-cosmo", + "discord": "cptn_cosmo", + "flags": {} } ], "relationships": { diff --git a/scripts/MovableCountdowns.js b/scripts/MovableCountdowns.js index 8d651b7..1f54517 100644 --- a/scripts/MovableCountdowns.js +++ b/scripts/MovableCountdowns.js @@ -76,8 +76,7 @@ export function createMovableCountdownsClass(BaseCountdowns) { // but next time it renders it will check flag. } - /**@inheritdoc */ - /**@inheritdoc */ + /** @inheritDoc */ async _renderFrame(options) { const frame = await super._renderFrame(options); @@ -117,6 +116,9 @@ export function createMovableCountdownsClass(BaseCountdowns) { // Ensure visibility this.element.hidden = false; + + // Add detached class to body for CSS blocking of system tracker + document.body.classList.add('dh-countdowns-detached'); } static async reattach() { @@ -130,10 +132,13 @@ export function createMovableCountdownsClass(BaseCountdowns) { } } - /** @override */ /** @override */ async close(options = {}) { await super.close(options); + + // Remove detached class from body + document.body.classList.remove('dh-countdowns-detached'); + // Re-attach on close if (ui.countdowns) { ui.countdowns._suppressed = false; diff --git a/styles/module.css b/styles/module.css index 12923a5..b6c2938 100644 --- a/styles/module.css +++ b/styles/module.css @@ -21,4 +21,10 @@ /* Ensure background image works if it relied on parent classes */ /* System uses .theme-dark .daggerheart.dh-style.countdowns */ -/* If the body has theme-dark, this should still work. */ \ No newline at end of file +/* If the body has theme-dark, this should still work. */ + +/* Hide system tracker when detached */ +/* Exclude .movable-countdowns explicitly to prevent self-hiding if classes leak or overlap */ +body.dh-countdowns-detached .daggerheart.dh-style.countdowns.faded-ui:not(.movable-countdowns) { + display: none !important; +} \ No newline at end of file