For macro and module authors.
const api = game.modules.get("dxcufgbs-exploration-mode").api;
await api.start(scene); // GM: start Exploration Mode, round 1 (scene defaults to the viewed one) → true/false
await api.nextRound(scene); // GM: next round: everyone's movement and dashes reset
await api.setPaused(true, scene); // GM: pause (true) or resume (false) the limits
await api.end(scene); // GM: end Exploration Mode and clear everyone's movement trail
api.isActive(scene); // is Exploration Mode on for the scene?
api.getRound(scene); // the round number (0 when off)
api.getState(scene); // {active, round, paused}
api.limitsOn(scene); // active, not paused and no combat running on the scene
api.getMovement(token); // {speed, used, remaining, budget, max, action, dashes: {action, bonus, bonusAvailable}}
api.canBonusDash(actor); // does the actor have a feature from the bonus-action dash setting?
await api.takeDash(token, "bonus"); // dash for an owned token this round, if still available ("action" or "bonus") → true/false
api.openPanel(); // open the Exploration panel
- The GM-only calls show a warning to players and return
false.sceneis optional everywhere and defaults to the scene being viewed. getMovementtakes a TokenDocument or a Token.speedis for the token's current movement type,budgetis speed × (1 + dashes taken),maxis what the token could reach with every dash it has,usedis this round's movement so far. A token whose actor has no dnd5e movement data getsInfinity.takeDashposts the chat line and calls the dash hook, just like choosing it in the dialog.
Moving a token past the limit
Moves made by other modules and macros (TokenDocument#move with the default method) are not limited. To make sure a move that copies a player's drag isn't cut either, add the module's option:
await tokenDoc.move(waypoints, { "dxcufgbs-exploration-mode": { ignoreLimit: true } });
Hooks
Hooks.on("dxcufgbsExplorationStart", scene => …): Exploration Mode started on a scene; runs on every client.Hooks.on("dxcufgbsExplorationRound", (scene, round) => …): a round began (also round 1 at the start); runs on every client.Hooks.on("dxcufgbsExplorationEnd", scene => …): Exploration Mode ended on a scene; runs on every client.Hooks.on("dxcufgbsExplorationDash", (tokenDoc, type) => …): a token dashed,typeis"action"or"bonus"; runs only on the client of the player who dashed.
From another module
The API is set during init, so it is ready from setup on. Make the integration optional:
Hooks.once("ready", () => {
const mod = game.modules.get("dxcufgbs-exploration-mode");
if (!mod?.active) return; // Exploration Mode not installed or not enabled
Hooks.on("dxcufgbsExplorationRound", (scene, round) => console.log(`${scene.name}: round ${round}`));
});
Add { "id": "dxcufgbs-exploration-mode", "type": "module" } to relationships.recommends in your module.json.
Data
flags.dxcufgbs-exploration-mode.stateon Scenes:{active, round, paused}. Read it withscene.getFlag("dxcufgbs-exploration-mode", "state"); change it through the API.flags.dxcufgbs-exploration-mode.dashon Tokens:{round, action, bonus}, the dashes taken in that round. A flag from an older round means no dashes yet.- A token's movement this round is its Foundry movement history (
tokenDoc.movementHistory), which the module records for player tokens while the limits are on and clears at every new round.
This page mirrors the Exploration Mode wiki on GitHub.