Various cleanups
This commit is contained in:
+5
-14
@@ -151,8 +151,8 @@ updateLightSources w = over tempLightSources f w
|
||||
|
||||
updateProjectiles :: World -> World
|
||||
updateProjectiles w = IM.foldl' (flip $ dbArg _pjUpdate) w $ _props w
|
||||
{-
|
||||
Apply internal particle updates, delete 'Nothing's. -}
|
||||
|
||||
{- Apply internal particle updates, delete 'Nothing's. -}
|
||||
updateParticles :: World -> World
|
||||
updateParticles w = set particles (catMaybes ps) w'
|
||||
where
|
||||
@@ -174,7 +174,7 @@ updateDoors :: World -> World
|
||||
updateDoors w = IM.foldl' (\w' dr -> _drMech dr dr w') w (_doors w)
|
||||
|
||||
ppEvents :: World -> World
|
||||
ppEvents w = IM.foldl' (flip $ \pp w' -> _ppEvent pp pp w') w $ _pressPlates w
|
||||
ppEvents w = IM.foldl' (flip $ \pp -> _ppEvent pp pp) w $ _pressPlates w
|
||||
|
||||
updateSeenWalls :: World -> World
|
||||
updateSeenWalls w = foldl' markWallSeen w wallsToUpdate
|
||||
@@ -188,23 +188,15 @@ markWallSeen w wl = w { _walls = IM.adjust mw (_wlID wl) $ _walls w }
|
||||
where
|
||||
mw wl' = wl' {_wlSeen = True}
|
||||
|
||||
--setTestStringIO :: IO World -> IO World
|
||||
--setTestStringIO = fmap (\ w -> set testString (show $ s w) w)
|
||||
-- where
|
||||
-- s w = (-.-) <$> (w ^? creatures . ix 0 . crPos) <*> (w ^? creatures . ix 0 . crOldPos)
|
||||
|
||||
checkEndGame :: World -> World
|
||||
checkEndGame w
|
||||
| _crHP (you w) < 1 = haltSound $ w {_menuLayers = [gameOverMenu]}
|
||||
| otherwise = w
|
||||
|
||||
--updateClouds :: World -> World
|
||||
--updateClouds w = w' & clouds %~ mapMaybe (updateCloud w)
|
||||
updateClouds :: World -> World
|
||||
updateClouds w = w' & clouds .~ catMaybes mclouds
|
||||
where
|
||||
(w',mclouds) = mapAccumR updateCloud w (_clouds w)
|
||||
-- did i write a mapMaybeAccumR ?
|
||||
|
||||
updateCloud :: World -> Cloud -> (World,Maybe Cloud)
|
||||
updateCloud w c
|
||||
@@ -303,14 +295,13 @@ rotateToOverlappingWall w = case theWall of
|
||||
p = _crPos cr
|
||||
theWall = overlapCircWallsReturnWall p (_crRad cr + 5) (IM.filter _wlRotateTo $ wallsNearPoint p w)
|
||||
|
||||
{-
|
||||
Finds the visible walls from a point to another point. -}
|
||||
{- Finds the visible walls from a point to another point. -}
|
||||
visibleWalls :: Point2 -> Point2 -> IM.IntMap Wall -> [Wall]
|
||||
visibleWalls p1 p2 ws
|
||||
= takeUntil _wlIsSeeThrough
|
||||
. map snd
|
||||
. sortOn (dist p1 . fromJust . fst)
|
||||
. filter ((/=) Nothing . fst)
|
||||
. filter (isJust . fst)
|
||||
. map f
|
||||
$ IM.elems ws
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user