Partially implement separate blocks

This commit is contained in:
2021-10-26 22:53:49 +01:00
parent d136fd910c
commit 12d43f9cf0
15 changed files with 145 additions and 115 deletions
+3 -3
View File
@@ -141,7 +141,7 @@ collidePointFire :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe Point2
collidePointFire p1 p2 ws
= safeMinimumOn (dist p1)
. IM.mapMaybe ( uncurry (intersectSegSeg p1 p2) . _wlLine )
$ IM.filter (\wl -> not (_wlIsSeeThrough wl && isJust (wl ^? blHP))) ws
$ IM.filter (\wl -> not (_wlIsSeeThrough wl && isJust (wl ^? wlBlockID))) ws
{- | Checks to see whether someone can fire bullets effectively between two points.
- Not sure if this needs vision as well, need to make this uniform. -}
collidePointFireVision :: Point2 -> Point2 -> IM.IntMap Wall -> Bool
@@ -149,7 +149,7 @@ collidePointFireVision p1 p2 ws
= any ( isJust . uncurry (intersectSegSeg p1 p2) . _wlLine)
$ IM.filter notBlockWindow ws
where
notBlockWindow wl = case wl ^? blHP of
notBlockWindow wl = case wl ^? wlBlockID of
Just _ -> not $ _wlIsSeeThrough wl
Nothing -> True
@@ -180,7 +180,7 @@ pathToPointFireable :: Int -> Point2 -> World -> Bool
pathToPointFireable i p w
= not
. pointHitsWalls (_crPos $ _creatures w IM.! i) p
$ IM.filter (isNothing . (^? blHP) ) $ wallsAlongLine p1 p w
$ IM.filter (isNothing . (^? wlBlockID) ) $ wallsAlongLine p1 p w
where
p1 = _crPos (_creatures w IM.! i)