Merge pull request #216 from dairefinn/master

Adds support for limited visibility NPC sheets
This commit is contained in:
Jalen
2025-07-22 11:41:48 -04:00
committed by GitHub
3 changed files with 44 additions and 18 deletions
+21 -18
View File
@@ -32,29 +32,32 @@ export default class DeltaGreenActorSheet extends foundry.appv1.sheets
/** @override */
get template() {
const templatePath = "systems/deltagreen/templates/actor";
let templateName = "limited-sheet.html";
if (this.actor !== null) {
if (this.actor.type === "agent") {
if (!game.user.isGM && this.actor.limited) {
return "systems/deltagreen/templates/actor/limited-sheet.html";
}
const actorIsLimited = !game.user.isGM && this.actor.limited;
// return `systems/deltagreen/templates/actor/${this.actor.data.type}-sheet.html`;
return `systems/deltagreen/templates/actor/actor-sheet.html`;
switch (this.actor.type) {
case "agent":
templateName = actorIsLimited ? "limited-sheet.html" : "actor-sheet.html";
break;
case "unnatural":
templateName = "unnatural-sheet.html"; // No limited sheet
break;
case "npc":
templateName = actorIsLimited ? "npc-limited-sheet.html" : "npc-sheet.html";
break;
case "vehicle":
templateName = "vehicle-sheet.html"; // No limited sheet
break;
default:
templateName = "actor-sheet.html"; // No limited sheet
break;
}
if (this.actor.type === "unnatural") {
return `systems/deltagreen/templates/actor/unnatural-sheet.html`;
}
if (this.actor.type === "npc") {
return `systems/deltagreen/templates/actor/npc-sheet.html`;
}
if (this.actor.type === "vehicle") {
return `systems/deltagreen/templates/actor/vehicle-sheet.html`;
}
return "systems/deltagreen/templates/actor/limited-sheet.html";
}
return "systems/deltagreen/templates/actor/limited-sheet.html";
return `${templatePath}/${templateName}`;
}
/** @override */
+1
View File
@@ -9,6 +9,7 @@ export default async function preloadHandlebarsTemplates() {
"systems/deltagreen/templates/actor/limited-sheet.html",
"systems/deltagreen/templates/actor/unnatural-sheet.html",
"systems/deltagreen/templates/actor/npc-sheet.html",
"systems/deltagreen/templates/actor/npc-limited-sheet.html",
"systems/deltagreen/templates/dialog/modify-percentile-roll.html",
"systems/deltagreen/templates/actor/vehicle-sheet.html",
"systems/deltagreen/templates/actor/partials/custom-skills-partial.html",
+22
View File
@@ -0,0 +1,22 @@
<form class="{{cssClass}} {{getCharacterSheetStyle}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
<div class="header-fields">
{{!-- Name, Profession, Portrait --}}
<div class="flexrow">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="150" width="100"/>
<div class="horizontal-flex-column">
<div>
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" title="{{localize 'DG.AgentNameFieldTooltip' }}"/></h1>
</div>
<div>
<h2 class="profession"><input name="system.biography.profession" type="text" value="{{actor.system.biography.profession}}" placeholder="{{localize 'DG.FallbackText.ProfessionAndOrRank'}}"/></h1>
</div>
</div>
</div>
</header>
</form>