caewok / fvtt-elevation-ruler

Modifies Foundry VTT ruler to display when dragging tokens, add token speed highlighting, do pathfinding, calculate elevation
MIT License
19 stars 17 forks source link

Issues with pathfinding in foundry v11 #146

Open Opius134 opened 4 months ago

Opius134 commented 4 months ago

Moving tokens around an obstacle or into a space where they don't have vision provokes an error, and prevents full movement/pathfinding.

This effects both dms and players. When it happens to a player, they're unable to move their token for a while. This happens with token vision on or off, fog of war on or off. This kind of behavior doesn't seem to happen in v12, but I haven't tested vigorously.

Additionally, moving through rooms will sometimes have tokens path through walls, rather than through open doors or around walls.

An error is generated in console when it fails to path, before the token is dropped:

Uncaught TypeError: Cannot read properties of undefined (reading 'center') at BorderEdge.edgeBlocks (BorderTriangle.js:174:30) at BorderEdge.vertexBlocks (BorderTriangle.js:219:17) at BorderEdge.getValidDestinations (BorderTriangle.js:137:16) at BorderTriangle.getValidDestinations (BorderTriangle.js:410:24) at BorderTriangle.getValidDestinationsWithCost (BorderTriangle.js:433:31) at Pathfinder._identifyDestinationsWithCost (pathfinding.js:354:49) at AStarPathSearch._evaluateNeighbors (algorithms.js:84:30) at AStarPathSearch._step (algorithms.js:202:10) at AStarPathSearch._run (algorithms.js:189:43) at AStarPathSearch.run (algorithms.js:47:10) at Pathfinder.runPath (pathfinding.js:259:38) at calculatePathPointsForSegment (segments.js:97:19) at Ruler._getMeasurementSegments (segments.js:57:7) at 🎁CONFIG.Canvas.rulerClass.prototype._getMeasurementSegments#0 (libWrapper-wrapper.js:187:52) at Ruler.measure (foundry.js:37154:26) at Ruler._onMouseMove (foundry.js:37541:12) at 🎁call_wrapped [as call_wrapped] (libWrapper-wrapper.js:507:22) at Ruler._onMouseMove (Ruler.js:625:10) at 🎁CONFIG.Canvas.rulerClass.prototype._onMouseMove#0 (libWrapper-wrapper.js:187:52) at Token5e._onDragLeftMove (Token.js:53:33) at 🎁CONFIG.Token.objectClass.prototype._onDragLeftMove#0 (libWrapper-wrapper.js:187:52) at MouseInteractionManager.callback (foundry.js:31766:17) at #handleDragMove (foundry.js:32113:26) at #handleMouseMove (foundry.js:32085:37) at Na.notifyListeners (earcut.js:128:75) at Na.notifyTarget (earcut.js:128:75) at Na.propagate (earcut.js:128:75) at Na.dispatchEvent (earcut.js:128:75) at Na.mapPointerMove (earcut.js:128:75) at Na.mapEvent (earcut.js:128:75) at yn.onPointerMove (earcut.js:128:75)

Foundry Virtual Tabletop: Version 11 Stable, 11.315 Game System: dnd5e, 3.2.1 Client: brave browser Active modules: Elevation Ruler (0.8.13) and libwrapper(1.12.14.0)

lucky-trill commented 4 months ago

I've also seen this issue. Same error related to ccwTriangle/cwTriangle somehow ending up undefined in BorderTriangles.

If nothing else, it would be nice if pathfinding would aggressively fall back on core movement when it encounters failure.