Add setting to use a static color for the first speed instead of player color (resolves #10)

This commit is contained in:
Manuel Vögele
2021-02-08 16:27:11 +01:00
parent c09a85b470
commit 82685a1a2f
4 changed files with 16 additions and 1 deletions
+1
View File
@@ -1,6 +1,7 @@
## In development ## In development
### New features ### New features
- Right click and spacebar can now be swapped, allowing to place waypoints with right click and removing them with spacebar - Right click and spacebar can now be swapped, allowing to place waypoints with right click and removing them with spacebar
- The module can now be configured use a fixed color instead of the player color for the first speed range
### Bugfixes ### Bugfixes
- Disabling snap to grid with shift now works as expected - Disabling snap to grid with shift now works as expected
+4
View File
@@ -22,6 +22,10 @@
"system": "System" "system": "System"
} }
}, },
"staticFirstColor": {
"name": "Static First Color",
"hint": "Use a static color for the first movement range instead of the player color"
},
"swapSpacebarRightClick": { "swapSpacebarRightClick": {
"name": "Swap spacebar and right click", "name": "Swap spacebar and right click",
"hint": "Swaps the functions of spacebar and right click during dragging. If enabled right click will place waypoints and spacebar will delete them" "hint": "Swaps the functions of spacebar and right click during dragging. If enabled right click will place waypoints and spacebar will delete them"
+2 -1
View File
@@ -216,7 +216,8 @@ function getColorForDistance(startDistance, subDistance) {
return this.color return this.color
} }
const distance = startDistance + subDistance const distance = startDistance + subDistance
const ranges = currentSpeedProvider(this.draggedToken, this.color) const firstColor = game.settings.get(settingsKey, "staticFirstColor") ? 0x00FF00 : this.color
const ranges = currentSpeedProvider(this.draggedToken, firstColor)
if (ranges.length === 0) if (ranges.length === 0)
return this.color return this.color
const currentRange = ranges.reduce((minRange, currentRange) => { const currentRange = ranges.reduce((minRange, currentRange) => {
+9
View File
@@ -53,4 +53,13 @@ export function registerSettings() {
type: Number, type: Number,
default: getDefaultDashMultiplier(), default: getDefaultDashMultiplier(),
}) })
game.settings.register(settingsKey, "staticFirstColor", {
name: "drag-ruler.settings.staticFirstColor.name",
hint: "drag-ruler.settings.staticFirstColor.hint",
scope: "world",
config: true,
type: Boolean,
default: false,
})
} }