Add objects based on walls, called machines

This commit is contained in:
2021-10-31 22:55:02 +00:00
parent 08fa84c1fd
commit 86fdfd260e
23 changed files with 183 additions and 90 deletions
+4 -3
View File
@@ -90,8 +90,8 @@ splinterBlock bl w = foldr unshadowBlock w (_blShadows bl) -- foldr shiftTowardC
ps = map (fst . _wlLine) wls
cen = centroid ps
theSoundEffect
| _wlIsSeeThrough (head wls) = mkSoundSplinterGlass
| otherwise = mkSoundSplinterBlock
| _wlOpacity (head wls) == SeeThrough = mkSoundSplinterGlass
| otherwise = mkSoundSplinterBlock
unshadowBlock :: Int -> World -> World
unshadowBlock wlid w = case w ^? walls . ix wlid of
@@ -298,7 +298,7 @@ rotateToOverlappingWall w = case theWall of
{- Finds the visible walls from a point to another point. -}
visibleWalls :: Point2 -> Point2 -> IM.IntMap Wall -> [Wall]
visibleWalls p1 p2 ws
= takeUntil _wlIsSeeThrough
= takeUntil theTest
. map snd
. sortOn (dist p1 . fromJust . fst)
. filter (isJust . fst)
@@ -306,3 +306,4 @@ visibleWalls p1 p2 ws
$ IM.elems ws
where
f wl = (uncurry intersectSegSeg (_wlLine wl) p1 p2, wl)
theTest wl = _wlOpacity wl /= Opaque