Add option to show colors of PCs to anyone, regardless of permissions
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"drag-ruler": {
|
"drag-ruler": {
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"alwaysShowSpeedForPCs": {
|
||||||
|
"name": "Show PC speed to everyone",
|
||||||
|
"hint": "If enabled the coloring based on actor speed for player characters will shown to everyone, even if they don't have observer permission for the character sheet."
|
||||||
|
},
|
||||||
"dashMultiplier": {
|
"dashMultiplier": {
|
||||||
"name": "Dash Multiplier",
|
"name": "Dash Multiplier",
|
||||||
"hint": "This can be used to give tokens a secondary speed during coloring of the measured path. Set it to 0 to disable the secondary speed."
|
"hint": "This can be used to give tokens a secondary speed during coloring of the measured path. Set it to 0 to disable the secondary speed."
|
||||||
|
|||||||
+3
-1
@@ -174,7 +174,9 @@ function getColorForDistance(startDistance, subDistance) {
|
|||||||
return this.color
|
return this.color
|
||||||
// Don't apply colors if the current user doesn't have at least observer permissions
|
// Don't apply colors if the current user doesn't have at least observer permissions
|
||||||
if (this.draggedToken.actor.permission < 2) {
|
if (this.draggedToken.actor.permission < 2) {
|
||||||
return this.color
|
// If this is a pc and alwaysShowSpeedForPCs is enabled we show the color anyway
|
||||||
|
if (!(this.draggedToken.actor.data.type === "character" && game.settings.get(settingsKey, "alwaysShowSpeedForPCs")))
|
||||||
|
return this.color
|
||||||
}
|
}
|
||||||
const distance = startDistance + subDistance
|
const distance = startDistance + subDistance
|
||||||
const ranges = currentSpeedProvider(this.draggedToken, this.color)
|
const ranges = currentSpeedProvider(this.draggedToken, this.color)
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ import {getDefaultDashMultiplier, getDefaultSpeedAttribute} from "./systems.js"
|
|||||||
export const settingsKey = "drag-ruler";
|
export const settingsKey = "drag-ruler";
|
||||||
|
|
||||||
export function registerSettings() {
|
export function registerSettings() {
|
||||||
|
game.settings.register(settingsKey, "alwaysShowSpeedForPCs", {
|
||||||
|
name: "drag-ruler.settings.alwaysShowSpeedForPCs.name",
|
||||||
|
hint: "drag-ruler.settings.alwaysShowSpeedForPCs.hint",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
|
||||||
// This setting will be modified by the api if modules register to it
|
// This setting will be modified by the api if modules register to it
|
||||||
game.settings.register(settingsKey, "speedProvider", {
|
game.settings.register(settingsKey, "speedProvider", {
|
||||||
name: "drag-ruler.settings.speedProvider.name",
|
name: "drag-ruler.settings.speedProvider.name",
|
||||||
|
|||||||
Reference in New Issue
Block a user