Skip to content

Developer Reference

CK edited this page Jun 30, 2026 · 2 revisions

Developer Reference

This page is a quick-reference companion to Developer Guide.

Use this page when you already know you are working on the module and need a fast answer to questions like:

  • where does this kind of change usually live?
  • what folder should I inspect first?
  • am I looking at source content or generated output?
  • what should I test first after I change this?

Purpose of this page

This page is meant to be:

  • fast to scan
  • useful while coding or tracing a bug
  • focused on “where do I look?” and “what else does this change touch?” rather than step-by-step teaching

If you are brand new to the repo, read Developer Guide first.

Core mental model

The SW5e Module is an SW5E implementation for DND5e, so most changes live at the boundary between:

  • FoundryVTT core
  • the DND5e system
  • SW5E-specific patches, templates, styles, localization, and content

When debugging or implementing a change, do not ask only “what file is wrong?” Ask:

  • is the problem in data preparation?
  • rendering or templates?
  • styles or theme scoping?
  • localization?
  • migration or normalization?
  • compendium source data?

Repo map

  • scripts/: runtime logic, hooks, migrations, feature mechanics, custom apps
  • scripts/patch/: DND5e-to-SW5E integration layer
  • templates/: Handlebars UI structure
  • styles/: LESS and built CSS
  • languages/: localization
  • packs/_source/: editable compendium source
  • packs/: generated compendium output
  • utils/: build and normalization helpers

Source-of-truth rules

  • edit source content, not generated output
  • prefer helper-based resolution over hardcoded module IDs or legacy paths
  • assume migration matters if the feature touches existing content

1.3.8 quick routing

Blaster reload and ammo UX

Likely files:

  • scripts/patch/blaster-reload.mjs
  • scripts/patch/blaster-ammo-ux.mjs

First runtime surfaces to test:

  • weapon row Reload control
  • private Reload card
  • Attack, Rapid, and Burst with empty or partial ammo

Power bonuses and overrides

Likely files:

  • scripts/patch/power-bonuses.mjs
  • scripts/powercasting-overrides.mjs
  • scripts/power-casting-ability-config.mjs

First runtime surfaces to test:

  • actor power save DCs
  • actor power attack rolls
  • Configure Powercasting app
  • Active Effect bonus paths

Starship combat state

Likely files:

  • scripts/starship-system-damage.mjs
  • scripts/starship-destruction-saves.mjs
  • scripts/starship-conditions.mjs
  • scripts/starship-token-status.mjs
  • scripts/patch/starship-sheet.mjs

First runtime surfaces to test:

  • starship Core | Inventory | Features | Effects | Description tabs
  • System Damage pips
  • Destruction Save tray
  • token HUD icon sync

Themes

Likely files:

  • scripts/theme.mjs
  • styles/less/theme-overrides.less
  • styles/less/rest-activity-dialog-theme.less
  • styles/less/active-effect-config-theme.less

First runtime surfaces to test:

  • manual theme setting changes
  • actor and item sheets
  • themed dialogs
  • icon-only controls and dropdowns

Quick routing by symptom

Label, wording, or terminology is wrong

Check:

  • languages/en.json
  • relevant templates
  • prep code that supplies labels

The layout is wrong

Check:

  • templates/
  • then the render or prep layer that supplies the template

The behavior is wrong, but the layout looks fine

Check:

  • scripts/patch/*
  • feature-specific runtime files
  • related data prep

A theme or dialog looks wrong

Check:

  • styles/less/*
  • scripts/theme.mjs
  • scope-application hooks

Fresh content works, older copied content does not

Check:

  • migration
  • normalization
  • whether the older item needs refresh or re-import

The source JSON is right, but Foundry is still wrong

Check:

  • whether you rebuilt packs
  • whether the wrong layer is actually being tested

Build and local workflow reminders

Useful scripts:

  • npm run lint
  • npm run build:styles
  • npm run build:db
  • npm run build:json
  • npm run build:clean

Important reminder:

  • npm run build:db requires Foundry to be fully stopped

External and in-repo references to trust

When you need context beyond this quick page, use:

Quick debugging checklist

When debugging a module issue, move in this order:

  1. classify the issue as runtime, template, style, localization, content, or migration
  2. compare against a known-good built-in example when possible
  3. inspect the source-of-truth location before touching generated output
  4. test both the visible UI result and the actual in-play behavior
  5. if older content is involved, assume migration may be part of the story until proven otherwise

Practical summary

If you want the shortest useful summary of this page, it is this:

  • scripts/ is usually behavior
  • templates/ is usually structure
  • styles/ is usually presentation
  • languages/ is usually visible text
  • packs/_source/ is editable content
  • the 1.3.8 hotspots are blasters, powercasting, starships, and themes

Clone this wiki locally