refactor(#266): move private sanity logic into prepareContext
This commit is contained in:
committed by
Tobias Frölich
parent
ee149dfcaf
commit
ed54e2dbd8
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user