From ee124af2026629d44ff98061f41e8f55c6c22027 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 18 Dec 2025 13:47:19 -0600 Subject: [PATCH] Add scrollbar to NPC actor sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create npc-body.hbs as combined body template with all sections - Simplify PARTS to header + body instead of individual sections - Add flex layout and custom scrollbar CSS for sheet-body - Preload npc-body.hbs template in vagabond.mjs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- module/sheets/npc-sheet.mjs | 17 +- module/vagabond.mjs | 1 + styles/scss/sheets/_actor-sheet.scss | 11 + templates/actor/npc-body.hbs | 310 +++++++++++++++++++++++++++ 4 files changed, 326 insertions(+), 13 deletions(-) create mode 100644 templates/actor/npc-body.hbs diff --git a/module/sheets/npc-sheet.mjs b/module/sheets/npc-sheet.mjs index 1168877..cf67ea1 100644 --- a/module/sheets/npc-sheet.mjs +++ b/module/sheets/npc-sheet.mjs @@ -47,17 +47,8 @@ export default class VagabondNPCSheet extends VagabondActorSheet { header: { template: "systems/vagabond/templates/actor/npc-header.hbs", }, - stats: { - template: "systems/vagabond/templates/actor/npc-stats.hbs", - }, - actions: { - template: "systems/vagabond/templates/actor/npc-actions.hbs", - }, - abilities: { - template: "systems/vagabond/templates/actor/npc-abilities.hbs", - }, - notes: { - template: "systems/vagabond/templates/actor/npc-notes.hbs", + body: { + template: "systems/vagabond/templates/actor/npc-body.hbs", }, }; @@ -172,8 +163,8 @@ export default class VagabondNPCSheet extends VagabondActorSheet { _configureRenderOptions(options) { super._configureRenderOptions(options); - // NPC sheets render all parts (no tabs) - options.parts = ["header", "stats", "actions", "abilities", "notes"]; + // NPC sheets render header and body (no tabs) + options.parts = ["header", "body"]; } /* -------------------------------------------- */ diff --git a/module/vagabond.mjs b/module/vagabond.mjs index 459f173..1ed66e8 100644 --- a/module/vagabond.mjs +++ b/module/vagabond.mjs @@ -67,6 +67,7 @@ async function preloadHandlebarsTemplates() { "systems/vagabond/templates/actor/parts/status-bar.hbs", // NPC sheet parts "systems/vagabond/templates/actor/npc-header.hbs", + "systems/vagabond/templates/actor/npc-body.hbs", "systems/vagabond/templates/actor/npc-stats.hbs", "systems/vagabond/templates/actor/npc-actions.hbs", "systems/vagabond/templates/actor/npc-abilities.hbs", diff --git a/styles/scss/sheets/_actor-sheet.scss b/styles/scss/sheets/_actor-sheet.scss index 877f162..ebac1e3 100644 --- a/styles/scss/sheets/_actor-sheet.scss +++ b/styles/scss/sheets/_actor-sheet.scss @@ -2141,6 +2141,16 @@ min-width: 450px; min-height: 500px; + // Form is a flex column to allow scrollable body + display: flex; + flex-direction: column; + height: 100%; + + // Header wrapper stays fixed at top + .header-wrapper { + flex-shrink: 0; + } + // ---------------------------------------- // NPC Header // ---------------------------------------- @@ -2383,6 +2393,7 @@ overflow-y: auto; flex: 1; min-height: 0; + @include custom-scrollbar; } // ---------------------------------------- diff --git a/templates/actor/npc-body.hbs b/templates/actor/npc-body.hbs new file mode 100644 index 0000000..55d4b5d --- /dev/null +++ b/templates/actor/npc-body.hbs @@ -0,0 +1,310 @@ +{{!-- NPC Sheet Body - Scrollable Content Wrapper --}} +
+ {{!-- Stats Section --}} +
+
+ {{!-- Zone --}} +
+ + +

{{zoneBehavior}}

+
+ + {{!-- Speed --}} +
+ +
+ + ft +
+
+ + {{!-- Size & Type --}} +
+
+ + +
+
+ + +
+
+ + {{!-- Appearing --}} +
+ + +
+
+ + {{!-- Movement Types --}} +
+

{{localize "VAGABOND.Movement"}}

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + {{!-- Senses --}} + {{#if hasSenses}} +
+ + {{#if senses.allsight}} + {{localize "VAGABOND.Allsight"}} + {{/if}} + {{#if senses.blindsight}} + {{localize "VAGABOND.Blindsight"}} + {{/if}} + {{#if senses.darkvision}} + {{localize "VAGABOND.Darkvision"}} + {{/if}} + {{#if senses.echolocation}} + {{localize "VAGABOND.Echolocation"}} + {{/if}} + {{#if senses.seismicsense}} + {{localize "VAGABOND.Seismicsense"}} + {{/if}} + {{#if senses.telepathy}} + {{localize "VAGABOND.Telepathy"}} + {{/if}} +
+ {{/if}} + + {{!-- Damage Modifiers --}} + {{#if hasDamageModifiers}} +
+ {{#if immunities.length}} +
+ +
+ {{#each immunities}} + {{this}} + {{/each}} +
+
+ {{/if}} + + {{#if resistances.length}} +
+ +
+ {{#each resistances}} + {{this}} + {{/each}} +
+
+ {{/if}} + + {{#if weaknesses.length}} +
+ +
+ {{#each weaknesses}} + {{this}} + {{/each}} +
+
+ {{/if}} +
+ {{/if}} +
+ + {{!-- Actions Section --}} +
+
+

{{localize "VAGABOND.Actions"}}

+ +
+ +
    + {{#each actions}} +
  • +
    + +
    + + +
    +
    + +
    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    + +
    + +
    +
  • + {{else}} +
  • +

    {{localize "VAGABOND.NoActions"}}

    + +
  • + {{/each}} +
+
+ + {{!-- Abilities Section --}} +
+
+

{{localize "VAGABOND.Abilities"}}

+ +
+ +
    + {{#each abilities}} +
  • +
    + +
    + + +
    +
    + +
    + +
    +
  • + {{else}} +
  • +

    {{localize "VAGABOND.NoAbilities"}}

    + +
  • + {{/each}} +
+
+ + {{!-- Notes Section --}} +
+ {{!-- Loot --}} +
+

{{localize "VAGABOND.Loot"}}

+
+ +
+
+ + {{!-- GM Notes --}} +
+

{{localize "VAGABOND.GMNotes"}}

+
+ +
+
+
+