Simplify explosions

This commit is contained in:
2025-12-05 12:05:30 +00:00
parent 4777b94dfc
commit a4f8369420
4 changed files with 83 additions and 78 deletions
+7 -1
View File
@@ -11,12 +11,14 @@ module Dodge.WorldEvent.ThingsHit (
thingsHitExceptCr,
crsHitRadial,
wlsHitRadial,
wlHitPos,
crHit,
crWlPbHit,
wlsHitUnsorted,
isWalkable,
) where
import ListHelp
import Control.Applicative
import Dodge.Wall.Pathing
import Data.Monoid
@@ -28,7 +30,7 @@ import Control.Monad
import Control.Lens
import Data.Bifunctor
import qualified Data.IntSet as IS
import Data.List (sortOn)
--import Data.List (sortOn)
import Data.Maybe
import Dodge.Base
import Dodge.Data.World
@@ -139,6 +141,10 @@ thingsHitExceptCr (Just cid) sp ep = filter t . thingsHit sp ep
wlsHit :: Point2 -> Point2 -> World -> [(Point2, Wall)]
wlsHit sp ep = sortOn (dist sp . fst) . wlsHitUnsorted sp ep
---- pushes out any hit point by one
wlHitPos :: Point2 -> Point2 -> World -> Point2
wlHitPos sp ep = maybe ep ((+ normalize (ep - sp)) . fst) . safeHead . wlsHit sp ep
wlsHitUnsorted :: Point2 -> Point2 -> World -> [(Point2, Wall)]
wlsHitUnsorted sp ep
| sp == ep = const mempty