Compare commits

...

6 Commits

6 changed files with 23 additions and 4 deletions
+6
View File
@@ -1,3 +1,9 @@
## 1.6.1
### API
- Added `onMovementHistoryUpdate` callback to Speed Providers, that allows them to perform game systems specific improvements to the movement history
- Added `dragRuler.resetMovementHistory` that clears the stored movement history for a token.
## 1.6.0
### Performance
- Greatly increased the performance when playing on huge maps and when moving many tokens at once.
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "drag-ruler",
"title": "Drag Ruler",
"description": "When dragging a token displays a ruler showing how far you've moved that token.",
"version": "1.6.0",
"version": "1.6.1",
"minimumCoreVersion" : "0.7.9",
"compatibleCoreVersion" : "0.7.9",
"authors": [
@@ -49,7 +49,7 @@
],
"socket": true,
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.6.0.zip",
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.6.1.zip",
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
"readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md",
"changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",
+1 -1
View File
@@ -64,7 +64,6 @@ async function animateTokens(tokens, draggedToken, draggedRays, wasPaused) {
return {token, rays: offsetRays, dx, dy};
});
trackRays(tokenAnimationData.map(({token}) => token), tokenAnimationData.map(({rays}) => rays));
for (const {token, rays} of tokenAnimationData) {
token._noAnimate = true;
}
@@ -88,6 +87,7 @@ async function animateTokens(tokens, draggedToken, draggedRays, wasPaused) {
for (const {token} of tokenAnimationData) {
token._noAnimate = false;
}
trackRays(tokenAnimationData.map(({token}) => token), tokenAnimationData.map(({rays}) => rays));
}
function calculateTokenOffset(tokenA, tokenB) {
+1
View File
@@ -22,6 +22,7 @@ Hooks.once("init", () => {
getMovedDistanceFromToken,
registerModule,
registerSystem,
resetMovementHistory,
}
})
+5 -1
View File
@@ -1,3 +1,5 @@
import {currentSpeedProvider} from "./api.js";
let socket;
Hooks.once("socketlib.ready", () => {
@@ -7,7 +9,9 @@ Hooks.once("socketlib.ready", () => {
export function updateCombatantDragRulerFlags(combat, updates) {
const combatId = combat.id;
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates);
// TODO Check if canvas.tokens.get is still neccessary in future foundry versions
return socket.executeAsGM(_socketUpdateCombatantDragRulerFlags, combatId, updates)
.then(() => currentSpeedProvider.onMovementHistoryUpdate(updates.map(update => canvas.tokens.get(combat.getCombatant(update._id).token._id))));
}
async function _socketUpdateCombatantDragRulerFlags(combatId, updates) {
+8
View File
@@ -84,6 +84,14 @@ 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.
* If your speed provider is storing any additional values that are relevant for the movement history, this function should
* await until those updates have completed inside foundry.
*/
async onMovementHistoryUpdate(tokens) {}
/**
* Returns the value that is currently set for the setting registered with the provided settingId.
*