Improve pathing debugging, work on door pathing
This commit is contained in:
@@ -160,17 +160,18 @@ drawInspectWall w wl = setLayer DebugLayer $
|
||||
drawDoorPaths :: World -> Int -> Picture
|
||||
drawDoorPaths w drid = fromMaybe mempty $ do
|
||||
paths <- w ^? doors . ix drid . drObstructs
|
||||
-- path <- listToMaybe paths
|
||||
-- undefined
|
||||
return $ foldMap (drawPathEdge . (^. _3)) paths
|
||||
-- return $ (drawPathEdge . (^. _3)) path
|
||||
|
||||
drawPathEdge :: PathEdge -> Picture
|
||||
drawPathEdge pe = setLayer DebugLayer $ color col $ arrow (_peStart pe) (_peEnd pe)
|
||||
where
|
||||
col = case _peObstacles pe of
|
||||
pos | WallObstacle `Set.member` pos -> blue
|
||||
| True -> red
|
||||
drawPathEdge pe = setLayer DebugLayer
|
||||
$ multiArrow (_peStart pe) (_peEnd pe) green (Set.map obstacleColor (_peObstacles pe))
|
||||
|
||||
obstacleColor :: EdgeObstacle -> Color
|
||||
obstacleColor eo = case eo of
|
||||
WallObstacle -> cyan
|
||||
DoorObstacle -> red
|
||||
AutoDoorObstacle -> yellow
|
||||
BlockObstacle -> blue
|
||||
|
||||
drawWorldSelect :: World -> Picture
|
||||
drawWorldSelect w = setLayer DebugLayer
|
||||
@@ -293,15 +294,8 @@ drawWlIDs cfig w = setLayer FixedCoordLayer $ foldMap f (_walls w)
|
||||
edgeToPic :: [Point2] -> PathEdge -> Picture
|
||||
edgeToPic poly pe
|
||||
| not (pointInPolygon sp poly) && not (pointInPolygon ep poly) = mempty
|
||||
| null $ _peObstacles pe
|
||||
= anarrow green
|
||||
| hasobstacle BlockObstacle
|
||||
= anarrow red
|
||||
| hasobstacle AutoDoorObstacle = anarrow yellow
|
||||
| otherwise = anarrow cyan
|
||||
| otherwise = drawPathEdge pe
|
||||
where
|
||||
hasobstacle = (`Set.member` _peObstacles pe)
|
||||
anarrow col = color col $ arrow sp ep
|
||||
sp = _peStart pe
|
||||
ep = _peEnd pe
|
||||
|
||||
|
||||
Reference in New Issue
Block a user