Developers
The API is available from ready.
const api = game.modules.get('mindful-encounters').api;| Method | Description |
|---|---|
toggleDone(tokenId, value, sceneId) | Set a token’s Done state. Can advance the turn. |
reportMoved(tokenId, distance, sceneId) | Add to a token’s moved total for the turn. Negative values refund. On a shared-budget scene, a contributing token’s distance goes to the shared total. |
logAction(tokenId, delta, sceneId) | Adjust a token’s action count for the turn, capped by the per-turn limit. |
setIncluded(ids, scene) | Set the token ids included in the turn. GM only. Can advance the turn. |
includedTokenIds(scene) | The token ids counted toward the turn. An explicit list is filtered to the current candidates. Without one, player-owned candidates that are not hidden, hostile, or secret count. |
candidateTokens(scene, forGM) | The tokens shown in the panel, sorted by group then name. |
undoLast(token) | Undo a Token placeable’s last move leg and refund its budget. Only legs moved on the calling client are recorded. |
forceAdvance(scene) | Mark every included token Done and advance the turn. GM only. Combat deferral and preAdvance still apply. Warns and does nothing when budgeted movement is off on the scene. |
setActive(value, scene) | Enable or disable budgeted movement on a scene. GM only. Enabling clears turn progress and freezes the world clock. Disabling releases it. |
setOverland(value, scene) | Set whether the scene uses the shared party budget. GM only. |
setPartyBudget(value, scene) | Set a scene’s shared party budget. GM only. |
setTurn(seq, scene) | Set the turn counter and clear turn progress. GM only. |
| Hook | Arguments | When |
|---|---|---|
mindful-encounters.preAdvance | { scene, turnSeq, seconds, tokenIds, forced } | Fires on the GM before the turn commits. Return false to cancel. forced is true for forceAdvance. |
mindful-encounters.advanced | { scene, turnSeq, seconds, tokenIds } | The turn advanced and the clock moved. Fires on the GM client that advanced it and on player clients. Player clients also fire it when setTurn raises the counter. |
mindful-encounters.refresh | none | A module setting or pacing profile that affects display changed. |
Hooks.on('mindful-encounters.preAdvance', ({ scene, tokenIds }) => { if (tokenIds.some((id) => scene.tokens.get(id)?.hidden)) return false;});The module also listens for travelPace.calculated. See Overland mode.
Speed adapters
Section titled “Speed adapters”The automatic cap sources read an actor’s base speed through a speed adapter. Other modules cannot register one. On a supported system, the built-in adapter reads the highest of an actor’s movement speeds. The Speed Data Path setting overrides the adapter. Tokens with no readable speed fall back to the default cap.
Queries
Section titled “Queries”Players send state writes as queries to the 3DS:ATLAS primary GM: mindful-encounters.requestDone, mindful-encounters.reportMoved, and mindful-encounters.requestAction. A player’s call to toggleDone, reportMoved, or logAction sends the matching query.
With no primary GM connected, a player’s toggleDone or logAction warns and changes nothing. reportMoved is dropped without a warning.
World time enforcement, the combat-deletion reset, torch burn, wandering prompts, and the travel budget prompt run on the primary GM alone.
All flags use the mindful-encounters scope.
| Flag | Location | Description |
|---|---|---|
turn | scene | Turn state: sequence, moved totals, Done states, actions, inclusion, shared total. |
active | scene | Whether budgeted movement is enabled on the scene. |
overland | scene | Whether the scene uses the shared party budget. |
partyBudget | scene | The shared overland budget. |
profile | scene | The id of the pacing profile applied to the scene. |
doom | scene | Doom clock state: threat level, per-token torch state, and the wandering table uuid. |
cap | token | A manual per-token budget that overrides the cap source. |