Start work on lasguns

This commit is contained in:
2022-07-06 22:24:02 +01:00
parent d63495e335
commit 0eb2fdc37e
9 changed files with 38 additions and 34 deletions
+8
View File
@@ -5,6 +5,7 @@ Find which objects lie upon a line.
module Dodge.WorldEvent.ThingsHit
( thingsHit
, thingHit
, thingHitFilt
, thingsHitExceptCr
)
where
@@ -35,6 +36,13 @@ crsHit sp ep
. overlap1SegCrs sp ep
. crsNearSeg sp ep
thingHitFilt :: (Creature -> Bool) -> (Wall -> Bool)
-> Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall)
thingHitFilt fcr fwl sp ep = runIdentity . S.head_ . S.filter (f . snd) . thingsHit sp ep
where
f (Left cr) = fcr cr
f (Right wl) = fwl wl
thingHit :: Point2 -> Point2 -> World -> Maybe (Point2, Either Creature Wall)
thingHit sp ep = runIdentity . S.head_ . thingsHit sp ep