Skip to content

Commit

Permalink
cleaned up stale code left over from the first saves setting implemen…
Browse files Browse the repository at this point in the history
…tation

orffen#69
  • Loading branch information
DC23 committed Nov 27, 2024
1 parent 103581b commit 343027a
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions module/settings/settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,11 @@ import { registerSavesSettings } from './saves-settings.mjs'
* pseudo-enum to make setting ID references less error prone
*/
export const SETTINGS = {
// AUTO_ROLL_TOKEN_HP: 'autoRollTokenHP',
// use the saves keys as the setting ID to make retrieval easy.
// So long as the system.key is unique, it's fine.
SAVE_DEATH_NAME: 'death',
SAVE_WANDS_NAME: 'wands',
SAVE_PARALYSIS_NAME: 'paralysis',
SAVE_BREATH_NAME: 'breath',
SAVE_SPELLS_NAME: 'spells',

SAVES_MENU: 'savesMenu',
SAVES_SETTINGS: 'savesSettings'
SAVES_SETTINGS: 'savesSettings',
}

// Use this internally for now. Refactoring the whole system is too big a job!
// Use this just for settings for now. Refactoring the whole system is too big a job!
export const SYSTEM_ID = 'basicfantasyrpg'

/**
Expand All @@ -29,27 +20,23 @@ export const SYSTEM_ID = 'basicfantasyrpg'
* flag to show a setting to GM users is only supported for a setting
* menu, not a setting itself.
*/
const GM_ONLY_SETTINGS = [
// SETTINGS.SAVE_DEATH_NAME,
// SETTINGS.SAVE_WANDS_NAME,
// SETTINGS.SAVE_PARALYSIS_NAME,
// SETTINGS.SAVE_BREATH_NAME,
// SETTINGS.SAVE_SPELLS_NAME
]
const GM_ONLY_SETTINGS = []

Hooks.on('renderSettingsConfig', (app, [html], context) => {
if (game.user.isGM) return

GM_ONLY_SETTINGS.forEach(id => {
html
.querySelector(`.form-group[data-setting-id="${SYSTEM_ID}.${id}"]`)
?.remove()
html.querySelector(`.form-group[data-setting-id="${SYSTEM_ID}.${id}"]`)?.remove()
})
})

export function registerSettings () {
/**
* If we have any settings submenus, they'd be defined in separate files and called from here.
* register settings menus
*/
registerSavesSettings()

/**
* register top-level settings
*/
registerSavesSettings()
}

0 comments on commit 343027a

Please sign in to comment.