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 { log, shim, CONST } from './shim.js'
import { log } from './shim.js'
function _checkModule (name) {
if (!game.modules.get(name)?.active && game.user.isGM) {
let action = 'install and activate'
if (game.modules.get(name)) action = 'activate'
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', () => {
_checkModule('warpgate')
CONST.FOUNDRY = foundry.CONST
CONST.SWADE = CONFIG.SWADE.CONST
log('Initialized SWADE MB Helpers')
})

View File

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