Allow bullets to fire above corspes
This commit is contained in:
@@ -5,6 +5,7 @@ Find which objects lie upon a line.
|
||||
-}
|
||||
module Dodge.WorldEvent.ThingsHit (
|
||||
thingsHit,
|
||||
thingsHitZ,
|
||||
thingHit,
|
||||
thingHitFilt,
|
||||
thingsHitExceptCr,
|
||||
@@ -38,6 +39,14 @@ thingsHit sp ep w =
|
||||
(map (second Left) (crsHit sp ep w))
|
||||
(map (second Right) (wlsHit sp ep w))
|
||||
|
||||
{- Does not hit corpses -}
|
||||
thingsHitZ :: Point2 -> Point2 -> World -> [(Point2, Either Creature Wall)]
|
||||
thingsHitZ sp ep w =
|
||||
List.mergeOn
|
||||
(dist sp . fst)
|
||||
(map (second Left) (crsHitZ sp ep w))
|
||||
(map (second Right) (wlsHit sp ep w))
|
||||
|
||||
crWlPbHit :: Point2 -> Point2 -> World -> [(Point2, Object)]
|
||||
crWlPbHit sp ep w =
|
||||
List.mergeOn
|
||||
@@ -59,6 +68,21 @@ crsHit sp ep w
|
||||
. crixsNearSeg sp ep
|
||||
$ w
|
||||
|
||||
crsHitZ :: Point2 -> Point2 -> World -> [(Point2, Creature)]
|
||||
crsHitZ sp ep w
|
||||
| sp == ep = mempty
|
||||
| otherwise =
|
||||
sortOn (dist sp . fst)
|
||||
. overlapSegCrs sp ep
|
||||
. mapMaybe (\cid -> f =<< w ^? cWorld . lWorld . creatures . ix cid)
|
||||
. IS.toList
|
||||
. crixsNearSeg sp ep
|
||||
$ w
|
||||
where
|
||||
f cr
|
||||
| HP{} <- cr ^. crHP = Just cr
|
||||
| otherwise = Nothing
|
||||
|
||||
pbsHit :: Point2 -> Point2 -> World -> [(Point2, PulseBall)]
|
||||
pbsHit sp ep w
|
||||
| sp == ep = mempty
|
||||
|
||||
Reference in New Issue
Block a user