Start simplifying/removing Wall records
This commit is contained in:
@@ -14,8 +14,11 @@ module Dodge.WorldEvent.ThingsHit (
|
||||
crHit,
|
||||
crWlPbHit,
|
||||
wlsHitUnsorted,
|
||||
isWalkable,
|
||||
) where
|
||||
|
||||
import Data.Monoid
|
||||
import qualified Data.Set as S
|
||||
import Linear
|
||||
import Dodge.Data.Object
|
||||
import Dodge.Creature.Radius
|
||||
@@ -155,3 +158,16 @@ crsHitRadial p r = mapMaybe f . crsNearCirc p r
|
||||
let cp = cr ^. crPos . _xy
|
||||
guard $ dist p cp < r + crRad (_crType cr)
|
||||
return (cp + (1 + crRad (_crType cr)) *.* (cp - p), cr)
|
||||
|
||||
isFlyable :: Point2 -> Point2 -> World -> Bool
|
||||
{-# INLINE isFlyable #-}
|
||||
isFlyable p1 p2 =
|
||||
not . (WallNotAutoOpen `S.member`)
|
||||
. foldMap (^. _2 . wlPathFlag)
|
||||
. wlsHitUnsorted p1 p2
|
||||
|
||||
isWalkable :: Point2 -> Point2 -> World -> Bool
|
||||
{-# INLINE isWalkable #-}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user