From f97ce680c870f279cc52eb26bb1e0d19e273fe8c Mon Sep 17 00:00:00 2001 From: Daire Finn Date: Fri, 18 Jul 2025 19:37:30 +0100 Subject: [PATCH 1/4] Adds limited visibility NPC sheets --- module/actor/actor-sheet.js | 30 +++++++++------------- module/templates.js | 1 + templates/actor/npc-limited-sheet.html | 35 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 templates/actor/npc-limited-sheet.html diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index ae8fdab..39e6f10 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -33,25 +33,19 @@ export default class DeltaGreenActorSheet extends foundry.appv1.sheets /** @override */ get template() { if (this.actor !== null) { - if (this.actor.type === "agent") { - if (!game.user.isGM && this.actor.limited) { - return "systems/deltagreen/templates/actor/limited-sheet.html"; - } - - // return `systems/deltagreen/templates/actor/${this.actor.data.type}-sheet.html`; - return `systems/deltagreen/templates/actor/actor-sheet.html`; + const actorIsLimited = !game.user.isGM && this.actor.limited; + switch (this.actor.type) { + case "agent": + return actorIsLimited ? "systems/deltagreen/templates/actor/limited-sheet.html" : "systems/deltagreen/templates/actor/actor-sheet.html"; + case "unnatural": + return `systems/deltagreen/templates/actor/unnatural-sheet.html`; // No limited sheet + case "npc": + return actorIsLimited ? "systems/deltagreen/templates/actor/npc-limited-sheet.html" : "systems/deltagreen/templates/actor/npc-sheet.html"; + case "vehicle": + return `systems/deltagreen/templates/actor/vehicle-sheet.html`; // No limited sheet + default: + return "systems/deltagreen/templates/actor/actor-sheet.html"; // No limited sheet } - 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"; diff --git a/module/templates.js b/module/templates.js index 2e602fa..7d4fe12 100644 --- a/module/templates.js +++ b/module/templates.js @@ -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", diff --git a/templates/actor/npc-limited-sheet.html b/templates/actor/npc-limited-sheet.html new file mode 100644 index 0000000..fc36c39 --- /dev/null +++ b/templates/actor/npc-limited-sheet.html @@ -0,0 +1,35 @@ +
+ + {{!-- Sheet Header --}} +
+ +
+ + {{!-- Name, Profession, Portrait --}} +
+ +
+
+

+
+
+

+
+
+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ {{!-- Biography Tab --}} +
+ {{> "systems/deltagreen/templates/actor/partials/cv-partial.html" }} +
+
+
+ From e24bc8c32e70fd03f66d12f4701dbc550cbecf70 Mon Sep 17 00:00:00 2001 From: Daire Finn Date: Fri, 18 Jul 2025 19:45:43 +0100 Subject: [PATCH 2/4] Removed "Personal" tab from npc-limited-sheet --- templates/actor/npc-limited-sheet.html | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/templates/actor/npc-limited-sheet.html b/templates/actor/npc-limited-sheet.html index fc36c39..ab9dbd5 100644 --- a/templates/actor/npc-limited-sheet.html +++ b/templates/actor/npc-limited-sheet.html @@ -18,18 +18,5 @@ - - {{!-- Sheet Tab Navigation --}} - - - {{!-- Sheet Body --}} -
- {{!-- Biography Tab --}} -
- {{> "systems/deltagreen/templates/actor/partials/cv-partial.html" }} -
-
From 216993132a4c6c39dc56d1557f397eae9516750c Mon Sep 17 00:00:00 2001 From: Daire Finn Date: Sat, 19 Jul 2025 13:51:41 +0100 Subject: [PATCH 3/4] Tidied up get template function some more --- module/actor/actor-sheet.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 39e6f10..5415e75 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -32,23 +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) { const actorIsLimited = !game.user.isGM && this.actor.limited; + switch (this.actor.type) { case "agent": - return actorIsLimited ? "systems/deltagreen/templates/actor/limited-sheet.html" : "systems/deltagreen/templates/actor/actor-sheet.html"; + templateName = actorIsLimited ? "limited-sheet.html" : "actor-sheet.html"; + break; case "unnatural": - return `systems/deltagreen/templates/actor/unnatural-sheet.html`; // No limited sheet + templateName = `unnatural-sheet.html`; // No limited sheet + break; case "npc": - return actorIsLimited ? "systems/deltagreen/templates/actor/npc-limited-sheet.html" : "systems/deltagreen/templates/actor/npc-sheet.html"; + templateName = actorIsLimited ? "npc-limited-sheet.html" : "npc-sheet.html"; + break; case "vehicle": - return `systems/deltagreen/templates/actor/vehicle-sheet.html`; // No limited sheet + templateName = `vehicle-sheet.html`; // No limited sheet + break; default: - return "systems/deltagreen/templates/actor/actor-sheet.html"; // No limited sheet + templateName = "actor-sheet.html"; // No limited sheet + break; } } - return "systems/deltagreen/templates/actor/limited-sheet.html"; + return `${templatePath}/${templateName}`; } /** @override */ From 204e3e5a57c96a6b1a8283246ed769b5839c2a53 Mon Sep 17 00:00:00 2001 From: Daire Finn Date: Sat, 19 Jul 2025 13:53:01 +0100 Subject: [PATCH 4/4] Consistent quotes usage --- module/actor/actor-sheet.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/actor/actor-sheet.js b/module/actor/actor-sheet.js index 5415e75..8918ca3 100644 --- a/module/actor/actor-sheet.js +++ b/module/actor/actor-sheet.js @@ -43,13 +43,13 @@ export default class DeltaGreenActorSheet extends foundry.appv1.sheets templateName = actorIsLimited ? "limited-sheet.html" : "actor-sheet.html"; break; case "unnatural": - templateName = `unnatural-sheet.html`; // No limited sheet + 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 + templateName = "vehicle-sheet.html"; // No limited sheet break; default: templateName = "actor-sheet.html"; // No limited sheet