Improved handling so that modules changing the game pause work normally

This commit is contained in:
WBHarry 2026-06-08 16:16:11 +02:00
parent 47a852754c
commit 9f3ffdbdbb
2 changed files with 16 additions and 3 deletions

View file

@ -1,9 +1,22 @@
export default class DhGamePause extends foundry.applications.ui.GamePause {
async _onRender(context, options) {
await super._onRender(context, options);
/* Avoid altering the styling if a module has subscribed to the renderGamePause hook */
if (!Hooks.events.renderGamePause?.length) {
this.element.classList.add('dh-style');
}
}
/** @override */
async _prepareContext(options) {
const context = await super._prepareContext(options);
context.spin = false;
context.icon = 'systems/daggerheart/assets/logos/compatible_with_DH_logos-10.png';
/* Avoid altering the gamepause context if a module has subscribed to the renderGamePause hook */
if (!Hooks.events.renderGamePause?.length) {
context.spin = options.spin ?? false;
context.icon = options.icon ?? 'systems/daggerheart/assets/logos/compatible_with_DH_logos-10.png';
}
return context;
}