@vttforge/core / ModuleRegistration
Interface: ModuleRegistration ​
Properties ​
actorDataModels? ​
readonlyoptionalactorDataModels?:Readonly<Record<string,unknown>>
Actor sub-types this module contributes, keyed by the bare type name. Registered under <id>.<type>, so declare them the same way in documentTypes.Actor in your manifest.
api? ​
readonlyoptionalapi?:Readonly<Record<string,unknown>>
What this module publishes at game.modules.get(id).api.
Written at the top of init, before onBeforeInit and before any CONFIG mutation. Nothing orders one package's init against another's, so a module that publishes late is a module some readers find empty, with no way to tell that apart from one that publishes nothing at all.
enrichers? ​
readonlyoptionalenrichers?: readonlyEnricherRegistration[]
Text enrichers this module 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 ​
readonlyid:string
Module id: must match the folder name and module.json id.
itemDataModels? ​
readonlyoptionalitemDataModels?:Readonly<Record<string,unknown>>
Item sub-types, same rule as actorDataModels.
keywords? ​
readonlyoptionalkeywords?: readonlyKeyword[]
Rules terms this module 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? ​
readonlyoptionalkeywordsJournal?:string|false
The name of the keywords journal. Default: the package title followed by "keywords". false registers the enricher and writes no journal.
onAfterInit? ​
readonlyoptionalonAfterInit?: () =>void
Runs after the mutations above, inside the same init hook.
Returns ​
void
onBeforeInit? ​
readonlyoptionalonBeforeInit?: () =>void
Runs before any CONFIG mutation: the usual home for the module API.
Returns ​
void
onI18nInit? ​
readonlyoptionalonI18nInit?: () =>void
Runs on i18nInit, after Foundry loads the language files.
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.
Returns ​
void
onReady? ​
readonlyoptionalonReady?: () =>void|Promise<void>
Runs once on ready.
Not GM-gated. Guard inside your callback when the work is GM-only.
Returns ​
void | Promise<void>
onSetup? ​
readonlyoptionalonSetup?: () =>void|Promise<void>
Runs on setup, after every package is loaded and before the canvas is drawn.
For a module this is also the first point where the system it is extending has finished its own init, so it is the place to read what the system registered. A setting registered during init can only be read from here on. Keep world data out of it, that is onReady.
Returns ​
void | Promise<void>
sheets? ​
readonlyoptionalsheets?: readonlySheetRegistration[]
Sheets this module 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? ​
readonlyoptionalstatusEffects?: readonlyStatusEffectConfig[]
Conditions this module adds to CONFIG.statusEffects, each keyed by its id. Prefix the id with the module id (my-module.dazed) so it cannot collide with the system's own. Added one by one, never assigned: the collection belongs to the system, and replacing it would delete the conditions the world depends on.