Start simplifying/removing Wall records

This commit is contained in:
2025-10-23 18:11:01 +01:00
parent fc7c4d6468
commit 819f0d37ea
18 changed files with 230 additions and 243 deletions
+16
View File
@@ -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