Restructure the dev settings so that other categories can be more easily created

This commit is contained in:
Oliver 2025-12-08 23:43:24 -07:00
parent f90cb3dbab
commit d71997a508
5 changed files with 26 additions and 12 deletions

View file

@ -1,9 +0,0 @@
/** @type {Map<string, boolean>} */
export const devSettings = new Map();
export function registerDevSetting(namespace, key, config) {
const visible = config.config;
config.config = false;
game.settings.register(namespace, key, config);
devSettings.set(`${namespace}.${key}`, visible);
};

View file

@ -0,0 +1,22 @@
/** @type {Map<string, Map<string, boolean>>} */
export const categories = new Map();
export function registerCategorySetting(category, namespace, key, config) {
let cat = categories.get(category);
if (!cat) {
cat = new Map();
categories.set(category, cat);
};
const visible = config.config;
config.config = false;
game.settings.register(namespace, key, config);
cat.set(`${namespace}.${key}`, visible);
};
/**
* A helper function that registers the setting to the "dev"
* category
*/
export function registerDevSetting(namespace, key, config) {
registerCategorySetting(`dev`, namespace, key, config);
};