Add setting to forbid the usage of pathfinding

This commit is contained in:
Manuel Vögele
2022-01-27 23:29:08 +01:00
parent 7e19fb95b0
commit 9140ef3acf
5 changed files with 26 additions and 2 deletions
+7
View File
@@ -1,8 +1,15 @@
import {getCenterFromGridPositionObj} from "./foundry_fixes.js";
import {settingsKey} from "./settings.js";
// TODO Wipe cache if walls layer is being modified
let cached_nodes = undefined;
export function is_pathfinding_enabled() {
if (!game.settings.get(settingsKey, "allowPathfinding"))
return false;
return game.settings.get(settingsKey, "autoPathfinding") != game.keyboard.isDown("y")
}
function get_node(pos, initialize=true) {
if (!cached_nodes)
// TODO Check if ceil is the right thing to do here