Wipe gridless cache if the wall layout changes

This commit is contained in:
Manuel Vögele
2022-02-15 09:14:04 +01:00
parent 2bf52e62dd
commit dd9a7ecf68
3 changed files with 18 additions and 4 deletions
+8 -1
View File
@@ -47,10 +47,17 @@ export function findPath(from, to, token, previousWaypoints) {
}
}
export function wipePathfindingCache() {
export function wipeGriddedPathfindingCache() {
cachedNodes = undefined;
}
export function wipeGridlessPathfindingCache() {
if (gridlessPathfinder) {
GridlessPathfinding.free(gridlessPathfinder);
gridlessPathfinder = undefined;
}
}
function getNode(pos, token, initialize=true) {
pos = {layer: 0, ...pos}; // Copy pos and set pos.layer to the default value if it's unset
if (!cachedNodes)