How skarpelen/comfort-chat-foundry-vtt works
Comfort Chat is a Foundry VTT module for formatting emote/description messages and transforming character speech with accents and drunk-speech effects. The main flow handles chat input, resolves the speaker’s actor state, transforms eligible in-character text, and creates chat messages; users can configure speech through chat commands or actor-sheet controls. EMM formatting is a separate branch of chat handling. The README describes a generic template rather than these features, so the graph follows the sampled implementation; hook wiring beyond the shown registrations is left unverified.
Main entry points: pipeline.ts Speech pipeline · drunkEffectState.ts Drunk effect state · emm/index.ts EMM chat hooks · speech/index.ts Speech hooks
Components 16
Foundry integration
- Feature registration
src/ts/features/index.ts
Emote messages
- EMM chat hooks
src/ts/features/emm/index.ts
Speech transformation
- Speech hooks
src/ts/features/speech/index.ts - Speech pipeline
src/ts/features/speech/pipeline.ts - Accent registry
src/ts/features/speech/accentRegistry.ts - Accent transformation
src/ts/features/speech/replacementAccent.ts - Drunk transformation
src/ts/features/speech/drunk.ts - Actor speech state
src/ts/features/speech/actorSpeechState.ts - Drunk effect state
src/ts/features/speech/drunkEffectState.ts - Speech commands
src/ts/features/speech/commands.ts - Actor-sheet controls
src/ts/features/speech/sheetSpeechUi.ts - Status effects
src/ts/features/speech/statusEffects.ts
Settings and state
- Debug settings
src/ts/settings.ts - Logger
src/ts/log.ts
Other components
- Foundry user
- Foundry VTT
Connections 25
- Foundry user → Foundry VTT: uses
- Foundry VTT → EMM chat hooks: dispatches chat
- Foundry VTT → Speech hooks: dispatches hooks
- Feature registration → EMM chat hooks: imports
src/ts/features/index.ts - Feature registration → Speech hooks: imports
src/ts/features/index.ts - EMM chat hooks → Speech pipeline: transforms plain chat
src/ts/features/emm/index.ts - EMM chat hooks → Foundry VTT: creates messages
src/ts/features/emm/index.ts - EMM chat hooks → Foundry VTT: processes descriptions
src/ts/features/emm/index.ts - Speech hooks → Speech commands: registers commands
src/ts/features/speech/index.ts - Speech hooks → Actor-sheet controls: registers hooks
src/ts/features/speech/index.ts - Speech hooks → Status effects: registers effects
src/ts/features/speech/index.ts - Speech pipeline → Actor speech state: reads actor state
src/ts/features/speech/pipeline.ts - Speech pipeline → Accent registry: gets accent
src/ts/features/speech/pipeline.ts - Speech pipeline → Accent transformation: applies accent
src/ts/features/speech/pipeline.ts - Speech pipeline → Drunk effect state: reads level
src/ts/features/speech/pipeline.ts - Speech pipeline → Drunk transformation: applies drunk speech
src/ts/features/speech/pipeline.ts - Accent registry → Accent transformation: builds accent data
src/ts/features/speech/accentRegistry.ts - Actor speech state → Drunk effect state: reads drunk level
src/ts/features/speech/actorSpeechState.ts - Drunk effect state → Drunk transformation: clamps level
src/ts/features/speech/drunkEffectState.ts - Drunk effect state → Status effects: uses status identifiers
src/ts/features/speech/drunkEffectState.ts - Speech commands → Actor speech state: sets accent
src/ts/features/speech/commands.ts - Speech commands → Drunk effect state: sets drunk level
src/ts/features/speech/commands.ts - Actor-sheet controls → Actor speech state: sets accent
src/ts/features/speech/sheetSpeechUi.ts - Actor-sheet controls → Drunk effect state: sets drunk level
src/ts/features/speech/sheetSpeechUi.ts - Logger → Debug settings: checks debug flag
src/ts/log.ts