Files
foundry-Slamother/module/mosh.js
T
2020-11-22 08:19:22 -07:00

78 lines
2.0 KiB
JavaScript

// Import Modules
import { MothershipActor } from "./actor/actor.js";
import { MothershipActorSheet } from "./actor/actor-sheet.js";
import { MothershipCreatureSheet } from "./actor/creature-sheet.js";
import { MothershipShipSheet } from "./actor/ship-sheet.js";
import { MothershipItem } from "./item/item.js";
import { MothershipItemSheet } from "./item/item-sheet.js";
import {
registerSettings
} from "./settings.js";
Hooks.once('init', async function () {
game.mosh = {
MothershipActor,
MothershipItem
};
/**
* Set an initiative formula for the system
* @type {String}
*/
CONFIG.Combat.initiative = {
formula: "1d100",
decimals: 2
};
// Define custom Entity classes
CONFIG.Actor.entityClass = MothershipActor;
CONFIG.Item.entityClass = MothershipItem;
registerSettings();
// Register sheet application classes
Actors.unregisterSheet("core", ActorSheet);
Actors.registerSheet("mosh", MothershipActorSheet, {
types: ['character'],
makeDefault: true
});
Actors.registerSheet("mosh", MothershipCreatureSheet, {
types: ['creature'],
makeDefault: false
});
Actors.registerSheet("mosh", MothershipShipSheet, {
types: ['ship'],
makeDefault: false
});
Items.unregisterSheet("core", ItemSheet);
Items.registerSheet("mosh", MothershipItemSheet, { makeDefault: true });
// If you need to add Handlebars helpers, here are a few useful examples:
Handlebars.registerHelper('concat', function () {
var outStr = '';
for (var arg in arguments) {
if (typeof arguments[arg] != 'object') {
outStr += arguments[arg];
}
}
return outStr;
});
/**
* Set default values for new actors' tokens
*/
Hooks.on("preCreateActor", (createData) => {
if (createData.type == "character") {
createData.token.vision = true;
createData.token.actorLink = true;
}
})
Handlebars.registerHelper('toLowerCase', function (str) {
return str.toLowerCase();
});
});