Add a hook that's called when the movement history is updated to the API

This commit is contained in:
Manuel Vögele
2021-04-30 00:01:41 +02:00
parent 6bf8083f7a
commit 56527ccf75
2 changed files with 10 additions and 1 deletions
+4 -1
View File
@@ -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) {