Fix shockwave damage radius for walls

This commit is contained in:
2025-10-28 08:09:44 +00:00
parent 20042fcf8d
commit d6c4d3d609
16 changed files with 137 additions and 314 deletions
+12 -3
View File
@@ -17,6 +17,7 @@ module Dodge.WorldEvent.ThingsHit (
isWalkable,
) where
import Control.Applicative
import Dodge.Wall.Pathing
import Data.Monoid
import qualified Data.Set as S
@@ -146,9 +147,17 @@ wlsHitUnsorted sp ep
wlsHitRadial :: Point2 -> Float -> World -> [(Point2, Wall)]
wlsHitRadial p r = mapMaybe f . wlsNearCirc p r
where
f wl = uncurry (intersectSegSeg p (p - r *.* v)) (_wlLine wl) <&> (,wl)
--f wl = uncurry (intersectSegSeg p (p - r *.* v)) (_wlLine wl) <&> (,wl)
f wl = mhp <&> (,wl)
where
v = normalizeV . vNormal . uncurry (-) $ _wlLine wl
(x,y) = wl ^. wlLine
t mp = do
p' <- mp
guard (distance p p' < r)
mp
orthp = t $ orthogonalPointOnSeg x y p
mhp = orthp <|> t (return x) <|> t (return y)
-- v = normalizeV . vNormal . uncurry (-) $ _wlLine wl
crsHitRadial :: Point2 -> Float -> World -> [(Point2, Creature)]
crsHitRadial p r = mapMaybe f . crsNearCirc p r
@@ -156,7 +165,7 @@ crsHitRadial p r = mapMaybe f . crsNearCirc p r
f cr = do
let cp = cr ^. crPos . _xy
guard $ dist p cp < r + crRad (_crType cr)
return (cp + (1 + crRad (_crType cr)) *.* (cp - p), cr)
return (cp + (1 + crRad (_crType cr)) *^ (cp - p), cr)
isFlyable :: Point2 -> Point2 -> World -> Bool
{-# INLINE isFlyable #-}