Files
vermine2047/module/totem.mjs
T
François-Xavier Guillois 7d7ec478e5 protections
2023-06-05 15:27:58 +02:00

78 lines
2.3 KiB
JavaScript

import { registerHooks } from "./system/hooks.mjs";
import { registerSettings } from "./system/settings.mjs";
// Import document classes.
import { TotemActor } from "./documents/actor.mjs";
import { TotemCharacterSheet } from "./sheets/character-sheet.mjs";
import { TotemNpcSheet } from "./sheets/npc-sheet.mjs";
import { TotemCreatureSheet } from "./sheets/creature-sheet.mjs";
import { TotemItem } from "./documents/item.mjs";
import { TotemItemSheet } from "./sheets/item-sheet.mjs";
import { TotemRoll } from "./system/roll.mjs";
import { TotemCombat } from "./system/fight.mjs";
// Import helper/utility classes and constants.
import { preloadHandlebarsTemplates, registerHandlebarsHelpers } from "./system/handlebars-manager.mjs";
import { TOTEM } from "./system/config.mjs";
/* -------------------------------------------- */
/* Init Hook */
/* -------------------------------------------- */
Hooks.once('init', async function() {
// Add utility classes to the global game object so that they're more easily
// accessible in global contexts.
game.totem = {
TotemActor,
TotemItem,
TotemRoll,
TotemCombat
};
// Add custom constants for configuration.
CONFIG.TOTEM = TOTEM;
/**
* Set an initiative formula for the system
* @type {String}
*/
CONFIG.Combat.initiative = {
formula: "1d10 + @abilities.dex.mod",
decimals: 2
};
// Define custom Document classes
CONFIG.Actor.documentClass = TotemActor;
CONFIG.Item.documentClass = TotemItem;
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet('totem', TotemCharacterSheet, {
types: ['character'],
makeDefault: true,
});
Actors.registerSheet('totem', TotemNpcSheet, {
types: ['npc'],
makeDefault: true,
});
Actors.registerSheet('totem', TotemCreatureSheet, {
types: ['creature'],
makeDefault: true,
}); // Register vehicle Sheet
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("totem", TotemItemSheet, { makeDefault: true });
registerHandlebarsHelpers(); // Register Handlebars helpers
registerHooks(); // register Hooks
registerSettings(); // register Engrenages Settings
// Preload Handlebars templates.
return preloadHandlebarsTemplates();
});