refactor(#266): move private sanity logic into prepareContext

This commit is contained in:
Tobias Frölich
2025-09-29 08:11:45 +02:00
committed by Tobias Frölich
parent ee149dfcaf
commit ed54e2dbd8
3 changed files with 26 additions and 16 deletions
+15
View File
@@ -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`,