Developers
The module exposes its API on the module entry once Foundry is ready:
const api = game.modules.get('mindful-encounters').api;| Method | Description |
|---|---|
toggleDone(tokenId, value, sceneId) | Set a token’s Done state. Routed to the active GM when called by a player. |
reportMoved(tokenId, distance, sceneId) | Add to a token’s moved total for the turn. Negative values refund. |
logAction(tokenId, delta, sceneId) | Adjust a token’s action count for the turn, capped by the per-turn limit. |
setIncluded(ids, scene) | Set the list of token ids included in the turn. GM only. |
includedTokenIds(scene) | The token ids counted toward the turn. An explicit set is filtered to the current candidate tokens. The fallback is player-owned candidates that are visible and not hostile or secret. |
candidateTokens(scene, forGM) | The tokens shown in the panel, sorted by group then name. |
undoLast(token) | Undo a token’s last recorded move leg and refund its budget. |
forceAdvance(scene) | Mark every included token Done and advance the turn. GM only. Warns and does nothing when budgeted movement is not enabled on the scene. |
| Hook | Arguments | When |
|---|---|---|
mindful-encounters.advanced | { scene, turnSeq, seconds } | A dungeon turn has advanced and the clock has moved. |
mindful-encounters.refresh | none | A setting changed that affects display. Re-render UI that reflects module state. |
Hooks.on('mindful-encounters.advanced', ({ scene, turnSeq, seconds }) => { console.log(`Turn ${turnSeq} on ${scene.name}, +${seconds}s`);});Speed adapters
Section titled “Speed adapters”A speed adapter reads an actor’s base speed for the automatic cap sources. Adapters are internal and 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”State writes run through the GM client. Players send requests as queries the active GM answers: mindful-encounters.requestDone, mindful-encounters.reportMoved, and mindful-encounters.requestAction. The API methods route through these automatically. Call the API rather than the queries directly.
| 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. |
cap | token | A manual per-token budget that overrides the cap source. |