update shim const handling

This commit is contained in:
Mike Bloy 2023-09-09 23:29:32 -05:00
parent dd9390f15f
commit 202ca09d18
2 changed files with 14 additions and 7 deletions

View File

@ -1,12 +1,12 @@
import { api } from './api.js' import { api } from './api.js'
import { log, shim, CONST } from './shim.js' import { log } from './shim.js'
function _checkModule (name) { function _checkModule (name) {
if (!game.modules.get(name)?.active && game.user.isGM) { if (!game.modules.get(name)?.active && game.user.isGM) {
let action = 'install and activate' let action = 'install and activate'
if (game.modules.get(name)) action = 'activate' if (game.modules.get(name)) action = 'activate'
ui.notifications.error( ui.notifications.error(
`SWADE MB Helpers requires the ${name} module. Please ${action} it.`) `SWADE MB Helpers requires the ${name} module. Please ${action} it.`)
} }
} }
@ -14,7 +14,5 @@ Hooks.on('setup', api.registerFunctions)
Hooks.on('ready', () => { Hooks.on('ready', () => {
_checkModule('warpgate') _checkModule('warpgate')
CONST.FOUNDRY = foundry.CONST
CONST.SWADE = CONFIG.SWADE.CONST
log('Initialized SWADE MB Helpers') log('Initialized SWADE MB Helpers')
}) })

View File

@ -1,6 +1,15 @@
export const CONST = { export class CONST {
SWADE: null, static get SWADE () {
FOUNDRY: null return CONFIG.SWADE.CONST
}
static get FOUNDRY () {
return foundry.CONST
}
static get WARPGATE () {
return warpgate.CONST
}
} }
export class shim { export class shim {