Add a hook that's called when the movement history is updated to the API
This commit is contained in:
+4
-1
@@ -1,3 +1,5 @@
|
||||
import {currentSpeedProvider} from "./api.js";
|
||||
|
||||
let socket;
|
||||
|
||||
Hooks.once("socketlib.ready", () => {
|
||||
@@ -7,7 +9,8 @@ Hooks.once("socketlib.ready", () => {
|
||||
|
||||
export function updateCombatantDragRulerFlags(combat, updates) {
|
||||
const combatId = combat.id;
|
||||
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates);
|
||||
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
|
||||
.then(() => currentSpeedProvider.onMovementHistoryUpdate(updates.map(update => combat.getCombatant(update._id).token)));
|
||||
}
|
||||
|
||||
async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
|
||||
|
||||
@@ -84,6 +84,12 @@ export class SpeedProvider {
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* This hook is being called after Drag Ruler has updated the movement history for one or more tokens.
|
||||
* It'll receive an array of tokens that have been updated
|
||||
*/
|
||||
async onMovementHistoryUpdate(tokens) {}
|
||||
|
||||
/**
|
||||
* Returns the value that is currently set for the setting registered with the provided settingId.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user