From 4be6730fd598d74200e3ab86a4e781b47efe3169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 20 Apr 2021 16:59:06 +0200 Subject: [PATCH] Use parseInt on the speed attribute to increase compatibility with game systems (resolves #60) --- CHANGELOG.md | 5 +++++ src/speed_provider.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f81789..ef35fde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## In development +### 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)) + + ## 1.5.2 ### Bugfixes - Drag Ruler no longer prevents tokens that don't have an actor from being moved. ([#58](https://github.com/manuelVo/foundryvtt-drag-ruler/issues/58)) diff --git a/src/speed_provider.js b/src/speed_provider.js index 5623e76..6ffcb47 100644 --- a/src/speed_provider.js +++ b/src/speed_provider.js @@ -124,7 +124,7 @@ export class GenericSpeedProvider extends SpeedProvider { const speedAttribute = this.getSetting("speedAttribute") if (!speedAttribute) return [] - const tokenSpeed = getProperty(token, speedAttribute) + const tokenSpeed = parseInt(getProperty(token, speedAttribute)); if (tokenSpeed === undefined) { console.warn(`Drag Ruler (Generic Speed Provider) | The configured token speed attribute "${speedAttribute}" didn't return a speed value. To use colors based on drag distance set the setting to the correct value (or clear the box to disable this feature).`) return []