From 6472c1d5bd0713f84cbe1be461dc1004988471f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Wed, 21 Apr 2021 09:05:50 +0200 Subject: [PATCH] Don't include the movement history in collission checks (fixes #61) --- CHANGELOG.md | 5 +++++ src/foundry_imports.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ef8ec..7b73228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## In development +### Bugfixes +- Fixed a bug that prevented tokens from being moved when their movement history collides with a wall. ([#61](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/61)) + + ## 1.5.3 ### Compatiblilty - Drag Ruler's Generic Speed Provider is now able to work with game systems that put non-number characters behind the tokens movement speed (like `30ft.`). One example for such a game system is Dungeon Crawl Classics. ([#60](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/60)) diff --git a/src/foundry_imports.js b/src/foundry_imports.js index b5d1f36..68c30f2 100644 --- a/src/foundry_imports.js +++ b/src/foundry_imports.js @@ -20,7 +20,7 @@ export async function moveTokens(draggedToken, selectedTokens) { if (!game.user.isGM) { const hasCollision = selectedTokens.some(token => { const offset = calculateTokenOffset(token, draggedToken) - const offsetRays = rays.map(ray => applyOffsetToRay(ray, offset)) + const offsetRays = rays.filter(ray => !ray.isPrevious).map(ray => applyOffsetToRay(ray, offset)) return offsetRays.some(r => canvas.walls.checkCollision(r)); }) if (hasCollision) {