From 55edd6b3ac62bcd0b5232c099f1cea6ea4369323 Mon Sep 17 00:00:00 2001 From: Chris Ryan Date: Tue, 19 Aug 2025 20:58:48 +1000 Subject: [PATCH] Part progress on adding config tab to scene config --- daggerheart.mjs | 9 +++++++++ lang/en.json | 10 +++++++++- module/applications/_module.mjs | 1 + module/applications/scene/_module.mjs | 1 + module/applications/scene/sceneConfig.mjs | 19 +++++++++++++++++++ module/systemRegistration/handlebars.mjs | 3 +++ templates/scene/dh-config.hbs | 7 +++++++ 7 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 module/applications/scene/_module.mjs create mode 100644 module/applications/scene/sceneConfig.mjs create mode 100644 templates/scene/dh-config.hbs diff --git a/daggerheart.mjs b/daggerheart.mjs index a2f41735..52afcf59 100644 --- a/daggerheart.mjs +++ b/daggerheart.mjs @@ -147,6 +147,15 @@ Hooks.once('init', () => { // Make Compendium Dialog resizable foundry.applications.sidebar.apps.Compendium.DEFAULT_OPTIONS.window.resizable = true; + applications.scene.DhSceneConfig.PARTS.dh = {template: "systems/daggerheart/templates/scene/dh-config.hbs"}; + applications.scene.DhSceneConfig.TABS.sheet.tabs.push({id: "dh", icon: "fa-solid"}); + + DocumentSheetConfig.registerSheet(foundry.documents.Scene, SYSTEM.id, applications.scene.DhSceneConfig , { + makeDefault: true, + label: "Daggerheart" + }); + + settingsRegistration.registerDHSettings(); RegisterHandlebarsHelpers.registerHelpers(); diff --git a/lang/en.json b/lang/en.json index a7a615f5..daf1cf2c 100755 --- a/lang/en.json +++ b/lang/en.json @@ -26,6 +26,14 @@ "CONTROLS": { "inFront": "In Front" }, + "SCENE": { + "TABS": { + "SHEET": { + "dh": "Daggerheart" + } + } + }, + "DAGGERHEART": { "ACTIONS": { "TYPES": { @@ -2427,5 +2435,5 @@ "configureAttribution": "Configure Attribution" } } - } + } } diff --git a/module/applications/_module.mjs b/module/applications/_module.mjs index d4ceb229..3dd0c78f 100644 --- a/module/applications/_module.mjs +++ b/module/applications/_module.mjs @@ -2,6 +2,7 @@ export * as characterCreation from './characterCreation/_module.mjs'; export * as dialogs from './dialogs/_module.mjs'; export * as hud from './hud/_module.mjs'; export * as levelup from './levelup/_module.mjs'; +export * as scene from './scene/_module.mjs'; export * as settings from './settings/_module.mjs'; export * as sheets from './sheets/_module.mjs'; export * as sheetConfigs from './sheets-configs/_module.mjs'; diff --git a/module/applications/scene/_module.mjs b/module/applications/scene/_module.mjs new file mode 100644 index 00000000..d312edc8 --- /dev/null +++ b/module/applications/scene/_module.mjs @@ -0,0 +1 @@ +export { default as DhSceneConfig } from './sceneConfig.mjs'; \ No newline at end of file diff --git a/module/applications/scene/sceneConfig.mjs b/module/applications/scene/sceneConfig.mjs new file mode 100644 index 00000000..2759563b --- /dev/null +++ b/module/applications/scene/sceneConfig.mjs @@ -0,0 +1,19 @@ + +export default class DhSceneConfig extends foundry.applications.sheets.SceneConfig { + + /** @inheritDoc */ + async _preparePartContext(partId, context, options) { + console.log("_preparePartContext", partId, context, options); + context = await super._preparePartContext(partId, context, options); + switch ( partId ) { + case "dh": + context.fields.rangeMeasurementSettingsOverride = "Override Global Range Measurement Settings"; + break; + default: + context = await super._preparePartContext(partId, context, options); + } + if ( partId in context.tabs ) context.tab = context.tabs[partId]; + return context; + } + +} \ No newline at end of file diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index ff741b91..cb7be42a 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -35,5 +35,8 @@ export const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/button-part.hbs', + + 'systems/daggerheart/templates/scene/dh-config.hbs', + ]); }; diff --git a/templates/scene/dh-config.hbs b/templates/scene/dh-config.hbs new file mode 100644 index 00000000..373ba9aa --- /dev/null +++ b/templates/scene/dh-config.hbs @@ -0,0 +1,7 @@ +
+
+
+ {{formInput fields.rangeMeasurementSettingsOverride value=source.rangeMeasurementSettingsOverride}} +
+
+
\ No newline at end of file