Skip to content
3 Death Saves

API and Hooks

Reach the API through game.modules.get('travel-pace').api, or the global TRAVELPACE object once the module initializes.

MethodDescription
unitThe world’s distance unit abbreviation.
calculateTravel(data)Calculate a journey without posting anything. Returns the result, or null when a travelPace.preCalculate listener cancelled it.
submitCalculation(data)Calculate a journey and post it to chat, firing travelPace.calculated. Returns the result, or null when cancelled.
createChatMessage(result)Post an already-calculated result to chat.
durationToSeconds(totalMinutes)Convert travel minutes to world-time seconds, following the Day Advance Mode setting. See Settings.
openCalculator()Open the calculator, or bring the open one forward.

calculateTravel and submitCalculation take:

PropertyDescription
mode'distance' or 'time'.
paceA travel pace id: 'slow', 'normal', or 'fast'.
distanceDistance in the world’s travel unit. Required in distance mode.
timeAn object with days, hours, and minutes. Required in time mode.
mountA resolved actor to travel as, or null to travel on foot.

A result carries the mode it ran in, the original input, the output (totalMinutes plus either time/timeFormatted or distance), the pace’s mechanical-effect text, the traveller’s resolved speed, the list of applied modifiers, their combined multiplier, and the traveller’s UUID when one was used.

Fires before a calculation runs. To cancel it, return false from a listener.

Passed a single object with data, the input payload, and modifiers, a mutable array of {id, label, multiplier} entries seeded with any active weather modifiers. To contribute your own multiplier alongside weather’s, push onto modifiers. See Weather and Conditions.

Fires after submitCalculation posts a chat message. Passed the result and the created ChatMessage.