Improve pulse laser/ball hit detection

This commit is contained in:
2026-03-26 15:07:33 +00:00
parent 40f5d22d88
commit c53e60b956
13 changed files with 193 additions and 185 deletions
+15
View File
@@ -14,6 +14,7 @@ module Dodge.WorldEvent.ThingsHit (
wlHitPos,
crHit,
crWlPbHit,
crWlPbHitZ,
wlsHitUnsorted,
isWalkable,
) where
@@ -66,6 +67,20 @@ crWlPbHit sp ep w =
toobj (Left cr) = OCreature cr
toobj (Right wl) = OWall wl
crWlPbHitZ :: Float -> Point2 -> Point2 -> World -> [(Point2, Object)]
crWlPbHitZ z sp ep w =
List.mergeOn
(dist sp . fst)
(map (fmap toobj) (thingsHitZ z sp ep w))
pballs
where
-- slightly arbitrary
pballs
| z > 15 && z < 25 = map (fmap OPulseBall) (pbsHit sp ep w)
| otherwise = mempty
toobj (Left cr) = OCreature cr
toobj (Right wl) = OWall wl
crsHit :: Point2 -> Point2 -> World -> [(Point2, Creature)]
crsHit sp ep w
| sp == ep = mempty