Start work on lasguns
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user