Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bed16de575 | |||
| 891bb1b4d8 | |||
| 43f26088b5 | |||
| 39a0787c79 | |||
| 3be898e49c | |||
| 817662bf30 | |||
| 56527ccf75 | |||
| 6bf8083f7a |
@@ -1,3 +1,14 @@
|
||||
## 1.6.2
|
||||
### Bugfixes
|
||||
- The reset movement history button now resets the movement history for all players, not just for the GM
|
||||
|
||||
|
||||
## 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
@@ -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.2",
|
||||
"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.2.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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -22,6 +22,7 @@ Hooks.once("init", () => {
|
||||
getMovedDistanceFromToken,
|
||||
registerModule,
|
||||
registerSystem,
|
||||
resetMovementHistory,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ export async function resetMovementHistory(combat, combatantId) {
|
||||
const dragRulerFlags = combatant.flags.dragRuler;
|
||||
if (!dragRulerFlags)
|
||||
return;
|
||||
dragRulerFlags.passedWaypoints = undefined;
|
||||
dragRulerFlags.trackedRound = undefined;
|
||||
dragRulerFlags.rulerState = undefined;
|
||||
dragRulerFlags.passedWaypoints = null;
|
||||
dragRulerFlags.trackedRound = null;
|
||||
dragRulerFlags.rulerState = null;
|
||||
await updateCombatantDragRulerFlags(combat, [{_id: combatantId, dragRulerFlags}]);
|
||||
}
|
||||
|
||||
+5
-1
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user