2 Commits
Author SHA1 Message Date
tevansandClaude Fable 5 7dcbd96b13 Fix pause overlay showing GAME PAUSED while unpaused — v2.0.5
Root cause of the toggle cycle bug: the theme set display:flex on
#pause.dg2-pause unconditionally, out-specificity-ing core's hidden
(unpaused) state. After unpausing, the pause element stayed visible and
showed Foundry's default GAME PAUSED markup (the overlay injector
correctly skips unpaused renders). Scope the flex layout to
#pause.dg2-pause.paused and explicitly hide :not(.paused).

Verified three full pause/unpause cycles: paused = radar scope visible,
unpaused = element hidden. (Earlier tests misread visibility via
offsetParent, which is always null for position:fixed elements.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 22:39:52 +01:00
tevansandClaude Fable 5 7bbe36c29e Deterministic pause overlay via GamePause subclass — v2.0.4
The v2.0.3 pauseGame-hook re-injection raced Foundry's own pause re-render:
on slower clients the default GAME PAUSED markup landed after our overlay,
so pressing Space after an unpause showed the stock screen. Register a
DG2GamePause subclass (CONFIG.ui.pause) that applies the radar-scope
overlay inside _onRender - part of every render, no timing window. Hook
fallbacks retained (with retries) for cores lacking the AppV2 GamePause.
Verified with five rapid unpause/pause cycles at 150ms settle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 22:27:50 +01:00
3 changed files with 33 additions and 3 deletions
+9
View File
@@ -539,12 +539,21 @@
#pause.dg2-pause {
background: none;
}
/* Layout ONLY while actually paused - never override Foundry's hidden
(unpaused) state, or the stock GAME PAUSED markup shows after unpausing. */
#pause.dg2-pause.paused {
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
}
#pause.dg2-pause:not(.paused) {
display: none;
}
#pause.dg2-pause img { display: none; }
.dg2-pause-scope {
+23 -2
View File
@@ -37,6 +37,24 @@ import RitualItemData from "./data/item/ritual.js";
const { Actors, Items } = foundry.documents.collections;
Hooks.once("init", async () => {
// Own the pause UI: applying our overlay inside _onRender means it is part
// of EVERY render of the pause application - no hook/timing races.
try {
const BasePause = foundry.applications?.ui?.GamePause;
if (BasePause) {
class DG2GamePause extends BasePause {
/** @override */
async _onRender(context, options) {
await super._onRender?.(context, options);
applyDG2PauseOverlay(this.element);
}
}
CONFIG.ui.pause = DG2GamePause;
}
} catch (ex) {
console.warn("Delta Green 2 | could not register pause subclass", ex);
}
Object.assign(CONFIG.Actor.dataModels, {
// The keys are the types defined in system.json documentTypes.Actor
agent: AgentData,
@@ -266,8 +284,11 @@ Hooks.on("renderGamePause", (_app, html) => {
});
Hooks.on("pauseGame", () => {
// Run after Foundry finishes its own pause render/toggle.
setTimeout(() => applyDG2PauseOverlay(), 60);
// Fallback for cores where the pause subclass isn't registered: re-apply
// after Foundry's own render, with retries to outlast a slow re-render.
for (const delay of [50, 250, 700]) {
setTimeout(() => applyDG2PauseOverlay(), delay);
}
});
Hooks.once("ready", () => applyDG2PauseOverlay());
+1 -1
View File
@@ -15,7 +15,7 @@
"discord": "jalensailin"
}
],
"version": "2.0.3",
"version": "2.0.5",
"compatibility": {
"minimum": "13",
"verified": "14",