Only showing the menu if there are extra resources

This commit is contained in:
WBHarry 2026-03-08 20:43:42 +01:00
parent 94a320b91c
commit e102a28305
2 changed files with 10 additions and 1 deletions

View file

@ -227,6 +227,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
async _preparePartContext(partId, context, options) { async _preparePartContext(partId, context, options) {
context = await super._preparePartContext(partId, context, options); context = await super._preparePartContext(partId, context, options);
switch (partId) { switch (partId) {
case 'header':
await this._prepareHeaderContext(context, options);
break;
case 'loadout': case 'loadout':
await this._prepareLoadoutContext(context, options); await this._prepareLoadoutContext(context, options);
break; break;
@ -241,6 +244,12 @@ export default class CharacterSheet extends DHBaseActorSheet {
return context; return context;
} }
async _prepareHeaderContext(context, _options) {
context.hasExtraResources = Object.keys(CONFIG.DH.ACTOR.characterResources).some(
key => !CONFIG.DH.ACTOR.characterBaseResources[key]
);
}
/** /**
* Prepare render context for the Loadout part. * Prepare render context for the Loadout part.
* @param {ApplicationRenderContext} context * @param {ApplicationRenderContext} context

View file

@ -83,7 +83,7 @@
</span> </span>
{{/times}} {{/times}}
</div> </div>
<button type="button" class="resource-manager" data-action="toggleResourceManagement"><i class="fa-solid fa-bars"></i></button> {{#if hasExtraResources}}<button type="button" class="resource-manager" data-action="toggleResourceManagement"><i class="fa-solid fa-bars"></i></button>{{/if}}
</div> </div>
{{#if document.system.class.value}} {{#if document.system.class.value}}
<div class="domains-section"> <div class="domains-section">