diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7aec2..33ec08c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Release/Patch Notes +## Version 1.7.0 - ????-??-?? + +### **Tech Debt** + +- [#267](https://github.com/deltagreen-foundryvtt/delta-green-foundry-vtt-system/pull/267) - Moved private sanity logic out of templates. + ## Version 1.6.1 - 2025-09-09 > Thanks to the following new contributor: [Tobifroe](https://github.com/tobifroe). diff --git a/module/sheets/base-actor-sheet.js b/module/sheets/base-actor-sheet.js index 7b1227c..76bd6bc 100644 --- a/module/sheets/base-actor-sheet.js +++ b/module/sheets/base-actor-sheet.js @@ -94,6 +94,21 @@ export default class DGActorSheet extends DGSheetMixin(ActorSheetV2) { this._prepareSkillTooltips(); } + // Handle private sanity setting, override for GMs. + const keepSanityPrivate = game.settings.get( + "deltagreen", + "keepSanityPrivate", + ); + if (keepSanityPrivate && !game.user.isGM) { + context.maxSan = "???"; + context.currentSan = "???"; + context.keepSanityPrivate = true; + } else { + context.maxSan = this.actor.system.sanity.max; + context.currentSan = this.actor.system.sanity.value; + context.keepSanityPrivate = false; + } + // Set sanity block per actor type. context.sanityInputs = await foundry.applications.handlebars.renderTemplate( `${DGActorSheet.TEMPLATE_PATH}/partials/sanity-${this.actor.type}.html`, diff --git a/templates/actor/partials/sanity-agent.html b/templates/actor/partials/sanity-agent.html index 3a84228..cf37ebb 100644 --- a/templates/actor/partials/sanity-agent.html +++ b/templates/actor/partials/sanity-agent.html @@ -1,27 +1,16 @@ -{{#if (keepSanityPrivate)}} - -/ -
-
???
-
-{{else}} /
-
{{numberFormat actor.system.sanity.max decimals=0 sign=false}}
+
{{ maxSan }}
-{{/if}}