Open walsh9 opened 7 years ago
I see, this makes sense. The current pathfinder consideres all directions equal, so a cell's passability is a boolean value. But I suppose you might want to make your cell accessible from one direction and inaccessible from other -- and the proposed change is backwards compatible, so +1 for a PR :-) Thanks!
To determine whether a cell is traversable in cases like thin walls (like dig dug), tiles with z-height (e.g. enemy that can only fall to a 'lower' tile and not climb to 'higher' ones), and other sorts of one-way terrain, you need to know what cell you are coming from.
Could the passableCallback receive 4 parameters (x, y, fromX, fromY) instead of just the current (x, y).
Honestly, I'm having a little trouble completely wrapping my head around pathfinding and not sure this would work for all possible pathfinders but I sketched out some Dijkstra maps on graph paper with these kinds of rules and it seemed to work out.
If this makes sense and is a desirable feature I'd be happy to work on a pull request.