Fix aiming with no weapon crash
This commit is contained in:
@@ -280,6 +280,16 @@ collideCircWalls p1 p2 rad ws
|
||||
-- . _wlLine') ws
|
||||
-- where
|
||||
-- f (a,_) = magV (p1 -.- a)
|
||||
--
|
||||
-- | Looks for first collision of a point with walls.
|
||||
-- If found, gives point and wall.
|
||||
collidePointWallsWall :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe (Point2,Wall)
|
||||
collidePointWallsWall p1 p2 ws
|
||||
= safeMinimumOn f
|
||||
$ IM.mapMaybe ( \wl -> uncurry (intersectSegSeg p1 p2) (_wlLine wl) <&> ( , wl ) )
|
||||
ws
|
||||
where
|
||||
f (a,_) = magV (p1 -.- a)
|
||||
|
||||
-- | Looks for first collision of a point with walls.
|
||||
-- If found, gives point and normal of wall.
|
||||
|
||||
Reference in New Issue
Block a user