Start work on pathfinding
This commit is contained in:
+2
-2
@@ -52,7 +52,6 @@ walkableNodeNear w p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear
|
||||
nodesNear = zonesExtract (w ^. pnZoning) $ zonesAroundPoint pnZoneSize p
|
||||
|
||||
makePathBetweenPs :: Point2 -> Point2 -> World -> Maybe [Point2]
|
||||
--makePathBetweenPs a b w = mapMaybe (lab $ _pathGraph (_cWorld w)) <$> makePathBetween a b w
|
||||
makePathBetweenPs a b w = mapMaybe (lab $ w ^. cWorld . pathGraph) <$> makePathBetween a b w
|
||||
|
||||
bfsNodePoints :: Int -> World -> [Point2]
|
||||
@@ -61,7 +60,8 @@ bfsNodePoints n w = mapMaybe (lab g) $ bfs n g
|
||||
g = w ^. cWorld . pathGraph
|
||||
|
||||
pointTowardsImpulse :: Point2 -> Point2 -> World -> Maybe Point2
|
||||
pointTowardsImpulse a b w = (find (flip (isWalkable a) w) . reverse) =<< makePathBetweenPs a b w
|
||||
pointTowardsImpulse a b w = (find (flip (isWalkable a) w) . reverse) =<<
|
||||
(makePathBetweenPs a b w <&> (<>[b]))
|
||||
|
||||
------ continues a walk from a list of points, without repetitions
|
||||
------ supposes that the list is non-empty
|
||||
|
||||
Reference in New Issue
Block a user