From 9d154cb303060107c497bc91896fd5b89fd9b3ec Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 18 Dec 2023 23:20:43 -0700 Subject: [PATCH] Create a generic sheet that my more specific sheets can extend --- module/sheets/GenericSheet.mjs | 18 ++++++++++++++++++ module/sheets/PlayerSheet.mjs | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 module/sheets/GenericSheet.mjs diff --git a/module/sheets/GenericSheet.mjs b/module/sheets/GenericSheet.mjs new file mode 100644 index 0000000..cb67430 --- /dev/null +++ b/module/sheets/GenericSheet.mjs @@ -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; + } +} \ No newline at end of file diff --git a/module/sheets/PlayerSheet.mjs b/module/sheets/PlayerSheet.mjs index 2bbe868..604ed6d 100644 --- a/module/sheets/PlayerSheet.mjs +++ b/module/sheets/PlayerSheet.mjs @@ -1,4 +1,6 @@ -export class PlayerSheet extends ActorSheet { +import { GenericSheet } from "./GenericSheet.mjs"; + +export class PlayerSheet extends GenericSheet { static get defaultOptions() { let opts = mergeObject( super.defaultOptions,