Create a generic sheet that my more specific sheets can extend

This commit is contained in:
Oliver-Akins 2023-12-18 23:20:43 -07:00
parent 2026785b09
commit 9d154cb303
2 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,18 @@
export class GenericSheet extends ActorSheet {
#propogatedSettings = [
`devMode`,
`showAvatarOnSheet`
];
getData() {
const ctx = super.getData();
// Send all of the settings that sheets need into their context
ctx.settings = {};
for (const setting of this.#propogatedSettings) {
ctx.settings[setting] = game.settings.get(`dotdungeon`, setting);
};
return ctx;
}
}

View file

@ -1,4 +1,6 @@
export class PlayerSheet extends ActorSheet { import { GenericSheet } from "./GenericSheet.mjs";
export class PlayerSheet extends GenericSheet {
static get defaultOptions() { static get defaultOptions() {
let opts = mergeObject( let opts = mergeObject(
super.defaultOptions, super.defaultOptions,