Part progress on adding config tab to scene config

This commit is contained in:
Chris Ryan 2025-08-19 20:58:48 +10:00
parent fcf35ac17e
commit 55edd6b3ac
7 changed files with 49 additions and 1 deletions

View file

@ -147,6 +147,15 @@ Hooks.once('init', () => {
// Make Compendium Dialog resizable // Make Compendium Dialog resizable
foundry.applications.sidebar.apps.Compendium.DEFAULT_OPTIONS.window.resizable = true; 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(); settingsRegistration.registerDHSettings();
RegisterHandlebarsHelpers.registerHelpers(); RegisterHandlebarsHelpers.registerHelpers();

View file

@ -26,6 +26,14 @@
"CONTROLS": { "CONTROLS": {
"inFront": "In Front" "inFront": "In Front"
}, },
"SCENE": {
"TABS": {
"SHEET": {
"dh": "Daggerheart"
}
}
},
"DAGGERHEART": { "DAGGERHEART": {
"ACTIONS": { "ACTIONS": {
"TYPES": { "TYPES": {
@ -2427,5 +2435,5 @@
"configureAttribution": "Configure Attribution" "configureAttribution": "Configure Attribution"
} }
} }
} }
} }

View file

@ -2,6 +2,7 @@ export * as characterCreation from './characterCreation/_module.mjs';
export * as dialogs from './dialogs/_module.mjs'; export * as dialogs from './dialogs/_module.mjs';
export * as hud from './hud/_module.mjs'; export * as hud from './hud/_module.mjs';
export * as levelup from './levelup/_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 settings from './settings/_module.mjs';
export * as sheets from './sheets/_module.mjs'; export * as sheets from './sheets/_module.mjs';
export * as sheetConfigs from './sheets-configs/_module.mjs'; export * as sheetConfigs from './sheets-configs/_module.mjs';

View file

@ -0,0 +1 @@
export { default as DhSceneConfig } from './sceneConfig.mjs';

View file

@ -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;
}
}

View file

@ -35,5 +35,8 @@ export const preloadHandlebarsTemplates = async function () {
'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/damage-part.hbs',
'systems/daggerheart/templates/ui/chat/parts/target-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/target-part.hbs',
'systems/daggerheart/templates/ui/chat/parts/button-part.hbs', 'systems/daggerheart/templates/ui/chat/parts/button-part.hbs',
'systems/daggerheart/templates/scene/dh-config.hbs',
]); ]);
}; };

View file

@ -0,0 +1,7 @@
<div class="tab{{#if tab.active}} active{{/if}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
<div class="form-group">
<div class="form-fields">
{{formInput fields.rangeMeasurementSettingsOverride value=source.rangeMeasurementSettingsOverride}}
</div>
</div>
</div>