Make laser fire above corpses

This commit is contained in:
2025-11-21 12:02:14 +00:00
parent 8bc2d6961f
commit dc1dca8aa0
3 changed files with 9 additions and 13 deletions
+4 -1
View File
@@ -5,6 +5,7 @@ module Dodge.Item.Weapon.LaserPath (
reflectPulseLaserAlong,
) where
import ListHelp
import Data.Bifunctor
import Data.Tuple
import Dodge.Base.Wall
@@ -19,7 +20,7 @@ import Linear
reflectLaserAlong ::
Float -> Point2 -> Point2 -> World -> (Maybe (Point2, Either Creature Wall), [Point2])
{-# INLINE reflectLaserAlong #-}
reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlUnshadowed sp ep w of
reflectLaserAlong phasev sp ep w = case safeHead $ filter g $ thingsHitZ 20 sp ep w of
Just (p, Right wl)
| Metal <- wl ^. wlMaterial ->
f
@@ -32,6 +33,8 @@ reflectLaserAlong phasev sp ep w = case thingHitFilt (const True) _wlUnshadowed
Nothing -> (Nothing, [ep])
where
f p a b = reflectLaserAlong phasev a b w & _2 .:~ p
g (_,Right wl) = wl ^. wlUnshadowed
g _ = True
refract :: Float -> Point2 -> Point2 -> Wall -> Point2 -> Point2
{-# INLINE refract #-}