From 65912df9897568b2efc5eb8cd4df4cc9ae852f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Sat, 10 Apr 2021 14:55:47 +0200 Subject: [PATCH] Add support for the Enhanced Terrain Layer module (resolves #50) --- CHANGELOG.md | 3 +++ src/speed_provider.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 457db95..5f203de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ### New features - In combat Drag Ruler will now remember the path that was taken by a token during the turn. Picking the token up during the same turn will continue the previous measurement, taking steps that are already taken into account. +### Module compatibility +- Drag Ruler is now fully compatible with the `Enhanced Terrain Layer` module. ([#50](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/50)) + ## 1.4.5 ### Bugfixes diff --git a/src/speed_provider.js b/src/speed_provider.js index 58a8d2c..5623e76 100644 --- a/src/speed_provider.js +++ b/src/speed_provider.js @@ -67,7 +67,7 @@ export class SpeedProvider { */ getCostForStep(token, area) { // Lookup the cost for each square occupied by the token - const costs = area.map(space => canvas.terrain.costGrid[space.y]?.[space.x]?.multiple ?? 1) + const costs = area.map(space => terrainRuler.getCost(space.x, space.y, {token})); // Return the maximum of the costs return costs.reduce((max, current) => Math.max(max, current)) }