Skip to content

@vttforge/core / SystemRegistration

Interface: SystemRegistration ​

Properties ​

actorDataModels? ​

readonly optional actorDataModels?: Readonly<Record<string, AnyClass>>

Map of documentTypes.Actor key → TypeDataModel class.


actorDocumentClass? ​

readonly optional actorDocumentClass?: AnyClass

Replacement for CONFIG.Actor.documentClass.


combat? ​

readonly optional combat?: object

Global initiative formula: assigned to CONFIG.Combat.initiative.

initiative ​

readonly initiative: object

initiative.decimals? ​

optional decimals?: number

initiative.formula ​

formula: string | null


enrichers? ​

readonly optional enrichers?: readonly EnricherRegistration[]

Text enrichers this system contributes, registered under <id>.<enricher id>.

Register them here rather than pushing to CONFIG.TextEditor.enrichers yourself: that array has four ways to accept an entry and then do nothing with it. See registerEnrichers.


id ​

readonly id: string

System id: must match the folder name and system.json id.


itemDataModels? ​

readonly optional itemDataModels?: Readonly<Record<string, AnyClass>>

Map of documentTypes.Item key → TypeDataModel class.


itemDocumentClass? ​

readonly optional itemDocumentClass?: AnyClass

Replacement for CONFIG.Item.documentClass.


keywords? ​

readonly optional keywords?: readonly Keyword[]

Rules terms this system defines. Each becomes @Keyword[id] in rich text, shown as its label with the description as tooltip, and all of them are written to a journal entry on the GM's client at ready. See Keyword.


keywordsJournal? ​

readonly optional keywordsJournal?: string | false

The name of the keywords journal. Default: the package title followed by "keywords". false registers the enricher and writes no journal.


onAfterInit? ​

readonly optional onAfterInit?: () => void

Optional post-init hook for work that depends on the mutations above.

Returns ​

void


onBeforeInit? ​

readonly optional onBeforeInit?: () => void

Optional pre-init hook for work that has to run before any of the CONFIG mutations (rare; usually used to assign globalThis.<systemId> API).

Returns ​

void


onI18nInit? ​

readonly optional onI18nInit?: () => void

Optional i18nInit hook. Fires after Foundry loads the language files and before setup.

This is where CONFIG labels get translated. game.i18n is not loaded during init, so game.i18n.localize() called there returns the key you passed it, and the untranslated key is what players see. Do it here instead, once, rather than localizing on every render.

Returns ​

void

Example ​

ts
onI18nInit: () => {
  for (const ability of Object.values(CONFIG.MY_SYSTEM.abilities)) {
    ability.label = game.i18n.localize(ability.label);
  }
},

onReady? ​

readonly optional onReady?: () => void | Promise<void>

Optional ready hook. Fires once after Foundry has finished bootstrap. The natural home for migration runners (createMigrationRunner().run()).

Not GM-gated. Guard inside your callback (if (!game.user.isGM) return;) when the work is GM-only, and migrations always are.

Returns ​

void | Promise<void>


onSetup? ​

readonly optional onSetup?: () => void | Promise<void>

Optional setup hook. Fires after every package is loaded and before the canvas is drawn.

The home for work that init is too early for and ready too late: a setting registered during init can only be read from here on, and compendium packs are available. Keep world data out of it, that is onReady.

Returns ​

void | Promise<void>


sheets? ​

readonly optional sheets?: readonly SheetRegistration[]

Sheets this system offers, registered under <id>.<sheet id>.

Register them here rather than calling Foundry's registerSheet yourself: Foundry derives the persisted key from the class name, and a bundler renames classes between builds. See registerSheets.


statusEffects? ​

readonly optional statusEffects?: readonly StatusEffectConfig[]

Conditions this system adds to CONFIG.statusEffects, each keyed by its id. An id that matches a core condition replaces it. The collection is never assigned wholesale: that would drop the conditions other packages added before this system's init ran.

MIT licensed.