More nesting of fields in CWorld

This commit is contained in:
2022-08-19 11:41:07 +01:00
parent 3b7841677a
commit 2e34481ab1
9 changed files with 58 additions and 40 deletions
+6 -6
View File
@@ -88,7 +88,7 @@ functionalUpdate w =
checkEndGame
-- . updateRandGen
. over uvWorld (mouseButtons . each .~ True) -- to determine if the mouse button is held
. over uvWorld (cWorld . worldClock +~ 1)
. over uvWorld (cWorld . cwTime . worldClock +~ 1)
. over uvWorld updateWorldSelect
. over uvWorld doRewind
. over uvWorld (hammers . each %~ moveHammerUp)
@@ -219,7 +219,7 @@ setOldPos cr =
--updateRandGen = randGen %~ (snd . (uniform :: StdGen -> (Int,StdGen)))
doRewind :: World -> World
doRewind w = case _maybeWorld (_cWorld w) of
doRewind w = case w ^. cWorld . cwTime . maybeWorld of
Just' cw ->
w & cWorld .~ cw
& timeFlow .~ RewindingLastFrame
@@ -444,13 +444,13 @@ markSeen :: Wall -> Wall
markSeen wl = wl{_wlSeen = True}
checkEndGame :: Universe -> Universe
checkEndGame uv = case _deathDelay (_cWorld w) of
checkEndGame uv = case w ^. cWorld . cwTime . deathDelay of
Just x
| x < 0 ->
uv & uvScreenLayers .~ [gameOverMenu]
& uvWorld . cWorld . deathDelay .~ Nothing
Just _ -> uv & uvWorld . cWorld . deathDelay . _Just -~ 1
_ | _crHP (you w) < 1 -> uv & uvWorld . cWorld . deathDelay ?~ 50
& uvWorld . cWorld . cwTime . deathDelay .~ Nothing
Just _ -> uv & uvWorld . cWorld . cwTime . deathDelay . _Just -~ 1
_ | _crHP (you w) < 1 -> uv & uvWorld . cWorld . cwTime . deathDelay ?~ 50
_ -> uv
where
w = _uvWorld uv