35 lines
981 B
TypeScript
35 lines
981 B
TypeScript
import { registerLightMeter } from "./themes/light-meter/lightMeter";
|
|
|
|
export function getCanvas(): Canvas {
|
|
if (!(canvas instanceof Canvas) || !canvas.ready) {
|
|
throw new Error('Canvas Is Not Initialized');
|
|
}
|
|
return canvas;
|
|
}
|
|
|
|
export function getGame(): Game {
|
|
if (!(game instanceof Game)) {
|
|
throw new Error('Game Is Not Initialized');
|
|
}
|
|
return game;
|
|
}
|
|
|
|
export function getCombats(): CombatEncounters {
|
|
if (!(getGame().combats instanceof CombatEncounters)) {
|
|
throw new Error('CombatEncounters Is Not Initialized');
|
|
}
|
|
return <CombatEncounters>getGame().combats;
|
|
}
|
|
|
|
/**
|
|
* Ready hook
|
|
*/
|
|
Hooks.on("ready", function () {
|
|
//@ts-ignore
|
|
if (!(game.modules.get("combatready")?.active ?? false)) {
|
|
ui?.notifications?.notify('Please make sure you have the "Combat Ready!" module installed and enabled.', "error");
|
|
}
|
|
});
|
|
Hooks.on("combatready.ready", (CombatReadyAnimationTheme, CombatReadyTimer) => {
|
|
registerLightMeter(CombatReadyTimer);
|
|
}); |