add another mode to the pathfinder

If toUnknown is set to true, then we ignore endX and endY and find the
nearest unknown node that we can get to.