Merge branch 'develop' into pathfinding

This commit is contained in:
Manuel Vögele
2022-02-01 12:03:53 +01:00
9 changed files with 38 additions and 17 deletions
+11
View File
@@ -1,3 +1,14 @@
## 1.11.2
### Bugfixes
- Fixed a memory leak that could cause the rule to slow down after using the pathfinding functionality for a while
### Misc
- GMs are now always allowed to use the pathfinding tool. The setting now only prevents players from using it.
### Compatibility
- Drag Ruler's generic speed provider is now aware of good defaults for Dungeonslayers 4
## 1.11.1 ## 1.11.1
### Bugfixes ### Bugfixes
- Fixed a bug that would cause the pathfinding algorithm to make tokens of size 2 and 4 to take an unnecessary step - Fixed a bug that would cause the pathfinding algorithm to make tokens of size 2 and 4 to take an unnecessary step
+1 -2
View File
@@ -52,15 +52,14 @@ export function registerKeybindings() {
precedence: -1, precedence: -1,
}); });
if (game.settings.get(settingsKey, "allowPathfinding")) {
game.keybindings.register(settingsKey, "togglePathfinding", { game.keybindings.register(settingsKey, "togglePathfinding", {
name: "drag-ruler.keybindings.togglePathfinding.name", name: "drag-ruler.keybindings.togglePathfinding.name",
hint: "drag-ruler.keybindings.togglePathfinding.hint", hint: "drag-ruler.keybindings.togglePathfinding.hint",
onDown: handleTogglePathfinding, onDown: handleTogglePathfinding,
onUp: handleTogglePathfinding, onUp: handleTogglePathfinding,
precedence: -1, precedence: -1,
restricted: !game.settings.get(settingsKey, "allowPathfinding"),
}); });
}
} }
function handleDeleteWaypoint() { function handleDeleteWaypoint() {
+1 -1
View File
@@ -11,7 +11,7 @@ let use5105 = false;
let gridlessPathfinder = undefined; let gridlessPathfinder = undefined;
export function isPathfindingEnabled() { export function isPathfindingEnabled() {
if (!game.settings.get(settingsKey, "allowPathfinding")) if (!game.user.isGM && !game.settings.get(settingsKey, "allowPathfinding"))
return false; return false;
return game.settings.get(settingsKey, "autoPathfinding") != togglePathfinding; return game.settings.get(settingsKey, "autoPathfinding") != togglePathfinding;
} }
+2 -1
View File
@@ -1,5 +1,6 @@
import {availableSpeedProviders, currentSpeedProvider, getDefaultSpeedProvider, updateSpeedProvider} from "./api.js"; import {availableSpeedProviders, currentSpeedProvider, getDefaultSpeedProvider, updateSpeedProvider} from "./api.js";
import {SpeedProvider} from "./speed_provider.js" import {SpeedProvider} from "./speed_provider.js"
import { early_isGM } from "./util.js";
export const settingsKey = "drag-ruler"; export const settingsKey = "drag-ruler";
@@ -96,7 +97,7 @@ export function registerSettings() {
name: "drag-ruler.settings.autoPathfinding.name", name: "drag-ruler.settings.autoPathfinding.name",
hint: "drag-ruler.settings.autoPathfinding.hint", hint: "drag-ruler.settings.autoPathfinding.hint",
scpoe: "client", scpoe: "client",
config: true, config: early_isGM(),
type: Boolean, type: Boolean,
defualt: false, defualt: false,
}); });
+3
View File
@@ -17,6 +17,8 @@ export function getDefaultSpeedAttribute() {
return "actor.data.data.movement.walk.value"; return "actor.data.data.movement.walk.value";
case "swade": case "swade":
return "actor.data.data.stats.speed.adjusted"; return "actor.data.data.stats.speed.adjusted";
case "ds4":
return "actor.data.data.combatValues.movement.total";
} }
return "" return ""
} }
@@ -32,6 +34,7 @@ export function getDefaultDashMultiplier() {
case "D35E": case "D35E":
case "sfrpg": case "sfrpg":
case "shadowrun5e": case "shadowrun5e":
case "ds4":
return 2 return 2
case "CoC7": case "CoC7":
return 5; return 5;
+7
View File
@@ -272,3 +272,10 @@ export function getMeasurePosition() {
const measurePosition = {x: mousePosition.x + rulerOffset.x, y: mousePosition.y + rulerOffset.y}; const measurePosition = {x: mousePosition.x + rulerOffset.x, y: mousePosition.y + rulerOffset.y};
return measurePosition; return measurePosition;
} }
// isGM function for use during loading when game.user isn't available yet
export function early_isGM() {
const level = game.data.users.find(u => u._id == game.data.userId).role;
const gmLevel = CONST.USER_ROLES.ASSISTANT;
return level >= gmLevel;
}
+2 -2
View File
@@ -48,8 +48,8 @@
}, },
"settings": { "settings": {
"allowPathfinding": { "allowPathfinding": {
"name": "Wegfindung aktivieren", "name": "Wegfindung für Spieler erlauben",
"hint": "Aktiviert Drag Ruler's Wegfindungsfunktion. Bitte beachte, dass die Wegfindung Wege durch unerkundeten Nebel des Kriegs und Ätherische Wände berechnen kann. Dies kann deinen Spielern Geheimnisse lüften, von denen sie noch nicht erfahren sollten." "hint": "Erlaubt es Spielern die Wegfindungs zu benutzen. Bitte beachte, dass die Wegfindung Wege durch unerkundeten Nebel des Kriegs und Ätherische Wände berechnen kann. Dies kann deinen Spielern Geheimnisse lüften, von denen sie noch nicht erfahren sollten."
}, },
"alwaysShowSpeedForPCs": { "alwaysShowSpeedForPCs": {
"name": "Geschwindigkeit von Spielercharakteren für jeden anzeigen", "name": "Geschwindigkeit von Spielercharakteren für jeden anzeigen",
+2 -2
View File
@@ -48,8 +48,8 @@
}, },
"settings": { "settings": {
"allowPathfinding": { "allowPathfinding": {
"name": "Enable pathfinding feature", "name": "Allow pathfinding for players",
"hint": "Enables Drag Ruler's pathfinding functionality in this world. Be aware that pathfinding can route through unexplored fog of war and Ethereal Walls, which might reveal secrets to your players ahead of time." "hint": "Allows players to use Drag Ruler's pathfinding functionality in this world. Be aware that pathfinding can route through unexplored fog of war and Ethereal Walls, which might reveal secrets to your players ahead of time."
}, },
"alwaysShowSpeedForPCs": { "alwaysShowSpeedForPCs": {
"name": "Show PC speed to everyone", "name": "Show PC speed to everyone",
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "drag-ruler", "name": "drag-ruler",
"title": "Drag Ruler", "title": "Drag Ruler",
"description": "When dragging a token displays a ruler showing how far you've moved that token.", "description": "When dragging a token displays a ruler showing how far you've moved that token.",
"version": "1.11.1", "version": "1.11.2",
"minimumCoreVersion" : "9.245", "minimumCoreVersion" : "9.245",
"compatibleCoreVersion" : "9", "compatibleCoreVersion" : "9",
"authors": [ "authors": [
@@ -65,7 +65,7 @@
], ],
"socket": true, "socket": true,
"url": "https://github.com/manuelVo/foundryvtt-drag-ruler", "url": "https://github.com/manuelVo/foundryvtt-drag-ruler",
"download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.1.zip", "download": "https://github.com/manuelVo/foundryvtt-drag-ruler/archive/v1.11.2.zip",
"manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json", "manifest": "https://raw.githubusercontent.com/manuelVo/foundryvtt-drag-ruler/master/module.json",
"readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md", "readme": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/README.md",
"changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md", "changelog": "https://github.com/manuelVo/foundryvtt-drag-ruler/blob/master/CHANGELOG.md",