Always allow the GM to use pathfinding
This commit is contained in:
+2
-2
@@ -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
@@ -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",
|
||||||
|
|||||||
+8
-9
@@ -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
@@ -10,7 +10,7 @@ let use5105 = false;
|
|||||||
export function isPathfindingEnabled() {
|
export function isPathfindingEnabled() {
|
||||||
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS)
|
if (canvas.grid.type === CONST.GRID_TYPES.GRIDLESS)
|
||||||
return false;
|
return false;
|
||||||
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
@@ -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,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user