Add the very first dev-oriented setting and a DevSettingsConfig to manage it

This commit is contained in:
Oliver 2025-12-07 17:38:08 -07:00
parent 28d0105397
commit 5573a5b674
6 changed files with 120 additions and 1 deletions

View file

@ -0,0 +1,37 @@
import { __ID__ } from "../consts.mjs";
import { Logger } from "../utils/Logger.mjs";
import { registerDevSetting } from "../utils/DevSettings.mjs";
const key = `autoUnpauseOnLoad`;
export function autoUnpauseOnLoad() {
const prevented = Hooks.call(`${__ID__}.preventSetting`, key);
if (!prevented) {
Logger.log(`Preventing setting "${key}" from being registered`);
return;
};
// #region Registration
Logger.log(`Registering setting: ${key}`);
registerDevSetting(__ID__, key, {
name: `OFT.setting.${key}.name`,
hint: `OFT.setting.${key}.hint`,
scope: `client`,
type: Boolean,
default: false,
config: game.user.isGM,
requiresReload: false,
});
// #endregion Registration
// #region Implementation
Hooks.once(`ready`, () => {
const autoUnpause = game.settings.get(__ID__, key);
if (autoUnpause && game.paused) {
Logger.debug(`setting:${key} | Unpausing the game`);
game.togglePause(false, { broadcast: true });
};
});
// #endregion Implementation
};