Start to make wall flags/pathing interaction more sensible
This commit is contained in:
+5
-4
@@ -15,6 +15,7 @@ module Dodge.Path (
|
||||
getEdgesCrossing,
|
||||
) where
|
||||
|
||||
import qualified Data.Set as S
|
||||
import qualified Algorithm.Search as AS
|
||||
import Control.Lens
|
||||
--import Data.Bifunctor
|
||||
@@ -82,7 +83,7 @@ makePathBetween :: Point2 -> Point2 -> World -> Maybe [Int]
|
||||
makePathBetween = makePathUsing $ not . pathEdgeObstructed
|
||||
|
||||
pathEdgeObstructed :: Set.Set EdgeObstacle -> Bool
|
||||
pathEdgeObstructed pe = any (`Set.member` pe) [DoorObstacle, BlockObstacle, ChasmObstacle]
|
||||
pathEdgeObstructed pe = any (`Set.member` pe) [WallObstacle WallNotAutoOpen, ChasmObstacle]
|
||||
|
||||
walkableNodeNear :: World -> Point2 -> Maybe Int
|
||||
{-# INLINE walkableNodeNear #-}
|
||||
@@ -129,17 +130,17 @@ pairsToIncGraph pairs =
|
||||
ps = Set.toList $ Set.map fst pairs <> Set.map snd pairs
|
||||
|
||||
obstructPathsCrossing ::
|
||||
EdgeObstacle ->
|
||||
S.Set EdgeObstacle ->
|
||||
Point2 ->
|
||||
Point2 ->
|
||||
World ->
|
||||
(World, [(Int,Int)])
|
||||
obstructPathsCrossing obstacletype s e w =
|
||||
obstructPathsCrossing obs s e w =
|
||||
( w & cWorld . incGraph %~ updateincedges
|
||||
, inces
|
||||
)
|
||||
where
|
||||
updateincedge = flip $ updateEdge (at obstacletype ?~ ())
|
||||
updateincedge = flip $ updateEdge (S.union obs)
|
||||
updateincedges gr = foldl' updateincedge gr inces
|
||||
inces = filter inedgecrosses $ nearSeg peZoneSize _incEdgeZoning s e w
|
||||
inedgecrosses (i, j) = isJust $ intersectSegSeg s e (f i) (f j)
|
||||
|
||||
Reference in New Issue
Block a user