-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit
- Loading branch information
Showing
2 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"id": "gnd-elevation-ruler-wod20-compatibility", | ||
"title": "Elevation Ruler World of Darkness 20th Anniversary Compatibility", | ||
"version": "1.0.0", | ||
"compatibility": { | ||
"minimum": "12", | ||
"verified": "12" | ||
}, | ||
"relationships": { | ||
"requires": [ | ||
{ | ||
"id": "elevationruler", | ||
"type": "module", | ||
"compatibility": {} | ||
} | ||
] | ||
}, | ||
"esmodules": [ | ||
"scripts/speed_provider.js" | ||
], | ||
"description": "Adds Basic Elevation Ruler Compatibility for World of Darkness 20th Anniversary.\nBased on Rapunzel77 TDE 5 Drag Ruler Integration (Das Schwarze Auge) module.", | ||
"authors": [ | ||
{ | ||
"name": "grandsome", | ||
"discord": "grandsome", | ||
"flags": {} | ||
}, | ||
{ | ||
"name": "caewok", | ||
"url": "https://github.com/caewok", | ||
"discord": "caewok#9192", | ||
"flags": {} | ||
}, | ||
{ | ||
"name": "Rapunzel7", | ||
"url": "https://github.com/Rapunzel77/dsa5-drag-ruler", | ||
"discord": "Rapunzel_77#7051", | ||
"flags": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
Hooks.once("init", () => { | ||
game.settings.register("wod20-elevation-ruler-integration", "walk", { | ||
name: "walk", | ||
scope: "client", | ||
config: true, | ||
type: new foundry.data.fields.ColorField(), | ||
default: "#00FF00", | ||
onChange: (value) => { refreshSpeedCategories(); } | ||
}); | ||
|
||
game.settings.register("wod20-elevation-ruler-integration", "jog", { | ||
name: "jog", | ||
scope: "client", | ||
config: true, | ||
type: new foundry.data.fields.ColorField(), | ||
default: "#0xFFFF00", | ||
onChange: (value) => { refreshSpeedCategories(); } | ||
}); | ||
|
||
game.settings.register("wod20-elevation-ruler-integration", "run", { | ||
name: "run", | ||
scope: "client", | ||
config: true, | ||
type: new foundry.data.fields.ColorField(), | ||
default: "0xFF8000", | ||
onChange: (value) => { refreshSpeedCategories(); } | ||
}); | ||
|
||
game.settings.register("wod20-elevation-ruler-integration", "unreachable", { | ||
name: "unreachable", | ||
scope: "client", | ||
config: true, | ||
type: new foundry.data.fields.ColorField(), | ||
default: "#FF0000", | ||
onChange: (value) => { refreshSpeedCategories(); } | ||
}); | ||
|
||
}); | ||
|
||
Hooks.once("ready", () => { | ||
refreshSpeedCategories(); | ||
|
||
CONFIG.elevationruler.SPEED.tokenSpeed = function (token) { | ||
const baseSpeed = token.actor.system.movement.jog; | ||
if (baseSpeed === null) return null; | ||
return Number(baseSpeed); | ||
}; | ||
|
||
CONFIG.elevationruler.SPEED.maximumCategoryDistance = function (token, speedCategory, tokenSpeed) { | ||
switch (speedCategory.name) { | ||
case "walk": | ||
return speedCategory.multiplier * tokenSpeed; | ||
case "jog": | ||
return speedCategory.multiplier * tokenSpeed; | ||
case "run": | ||
return speedCategory.multiplier * tokenSpeed; | ||
} | ||
return Number.POSITIVE_INFINITY; | ||
}; | ||
}); | ||
|
||
function refreshSpeedCategories() { | ||
let walkAction = { | ||
name: "walk", | ||
color: Color.from(game.settings.get("wod20-elevation-ruler-integration", "walk")), | ||
multiplier: 0.5 | ||
} | ||
|
||
let jogAction = { | ||
name: "jog", | ||
color: Color.from(game.settings.get("wod20-elevation-ruler-integration", "jog")), | ||
multiplier: 1 | ||
} | ||
let runAction = { | ||
name: "run", | ||
color: Color.from(game.settings.get("wod20-elevation-ruler-integration", "run")), | ||
multiplier: 2 | ||
} | ||
|
||
let Unreachable = { | ||
name: "Unreachable", | ||
color: Color.from(game.settings.get("wod20-elevation-ruler-integration", "unreachable")), | ||
multiplier: Number.POSITIVE_INFINITY | ||
} | ||
|
||
CONFIG.elevationruler.SPEED.CATEGORIES = [walkAction, jogAction, runAction, Unreachable]; | ||
} |