Non-convex chasms

This commit is contained in:
2026-01-26 10:59:51 +00:00
parent 962df63e62
commit a6976eae8d
11 changed files with 341 additions and 323 deletions
+6 -3
View File
@@ -21,7 +21,7 @@ module Dodge.WorldEvent.ThingsHit (
import ListHelp
import Control.Applicative
import Dodge.Wall.Pathing
import Data.Monoid
--import Data.Monoid
import qualified Data.Set as S
import Linear
import Dodge.Data.Object
@@ -182,6 +182,9 @@ isFlyable p1 p2 =
isWalkable :: Point2 -> Point2 -> World -> Bool
{-# INLINE isWalkable #-}
isWalkable p1 p2 w = isFlyable p1 p2 w && not (getAny $ foldMap f (w ^. cWorld . chasms))
isWalkable p1 p2 w = isFlyable p1 p2 w && not (any f (w ^. cWorld . cliffs))
where
f = foldMap (Any . isJust . uncurry (intersectSegSeg p1 p2)) . loopPairs
f = isJust . uncurry (intersectSegSeg p1 p2)
--isWalkable p1 p2 w = isFlyable p1 p2 w && not (getAny $ foldMap f (w ^. cWorld . chasms))
-- where
-- f = foldMap (Any . isJust . uncurry (intersectSegSeg p1 p2)) . loopPairs