Move universe IO effects outside of world
This commit is contained in:
+10
-8
@@ -62,7 +62,7 @@ updateUniverse u = case _menuLayers u of
|
||||
|
||||
{- | The update step. -}
|
||||
functionalUpdate :: Universe -> Universe
|
||||
functionalUpdate w = over uvWorld checkEndGame
|
||||
functionalUpdate w = checkEndGame
|
||||
-- . updateRandGen
|
||||
. over uvWorld (mouseButtons . each .~ True) -- to determine if the mouse button is held
|
||||
. over uvWorld (worldClock +~ 1)
|
||||
@@ -364,13 +364,15 @@ markWallSeen !w !i = w { _walls = IM.adjust markSeen i $ _walls w }
|
||||
markSeen :: Wall -> Wall
|
||||
markSeen wl = wl {_wlSeen = True}
|
||||
|
||||
checkEndGame :: World -> World
|
||||
checkEndGame w = case _deathDelay w of
|
||||
Just x | x < 0 -> w & sideEffects %~ ( . (menuLayers .~ [gameOverMenu]))
|
||||
& deathDelay .~ Nothing
|
||||
Just _ -> w & deathDelay . _Just -~ 1
|
||||
_ | _crHP (you w) < 1 -> w & deathDelay ?~ 50
|
||||
_ -> w
|
||||
checkEndGame :: Universe -> Universe
|
||||
checkEndGame uv = case _deathDelay w of
|
||||
Just x | x < 0 -> uv & menuLayers .~ [gameOverMenu]
|
||||
& uvWorld . deathDelay .~ Nothing
|
||||
Just _ -> uv & uvWorld . deathDelay . _Just -~ 1
|
||||
_ | _crHP (you w) < 1 -> uv & uvWorld . deathDelay ?~ 50
|
||||
_ -> uv
|
||||
where
|
||||
w = _uvWorld uv
|
||||
|
||||
updateGusts :: World -> World
|
||||
updateGusts w = w
|
||||
|
||||
Reference in New Issue
Block a user