Unify block wall types
This commit is contained in:
+7
-7
@@ -82,8 +82,8 @@ functionalUpdate w = case _menuLayers w of
|
||||
where
|
||||
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
|
||||
|
||||
splinterBlock :: Block' -> World -> World
|
||||
splinterBlock bl w = foldr unshadowBlock w (_blShadows' bl) -- foldr shiftTowardCen w (_blWallIDs bl)
|
||||
splinterBlock :: Block -> World -> World
|
||||
splinterBlock bl w = foldr unshadowBlock w (_blShadows bl) -- foldr shiftTowardCen w (_blWallIDs bl)
|
||||
& blocks . ix (_blID bl) . blHPs %~ tail
|
||||
& theSoundEffect cen
|
||||
where
|
||||
@@ -97,8 +97,8 @@ splinterBlock bl w = foldr unshadowBlock w (_blShadows' bl) -- foldr shiftToward
|
||||
unshadowBlock :: Int -> World -> World
|
||||
unshadowBlock wlid w = case w ^? walls . ix wlid of
|
||||
Just wl -> w
|
||||
& walls . ix wlid . blVisible .~ True
|
||||
& wallsZone . znObjects . ix x . ix y . ix wlid . blVisible .~ True
|
||||
& walls . ix wlid . wlDraw .~ True
|
||||
& wallsZone . znObjects . ix x . ix y . ix wlid . wlDraw .~ True
|
||||
where
|
||||
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
||||
Nothing -> w
|
||||
@@ -108,10 +108,10 @@ updateBlocks w = foldr f w $ _blocks w
|
||||
where
|
||||
f bl w' = case _blHPs bl of
|
||||
(x:_:_) | x < 1 -> splinterBlock bl w'
|
||||
(x:[]) | x < 1 -> destroyBlock bl w'
|
||||
[x] | x < 1 -> destroyBlock bl w'
|
||||
_ -> w'
|
||||
|
||||
destroyBlock :: Block' -> World -> World
|
||||
destroyBlock :: Block -> World -> World
|
||||
destroyBlock bl w = w
|
||||
& walls %~ removeIDs wlids
|
||||
& flip (foldr removeFromZone) wlids
|
||||
@@ -126,7 +126,7 @@ destroyBlock bl w = w
|
||||
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
||||
wl = _walls w IM.! wlid -- note the use of w not w'
|
||||
|
||||
-- | Note the explict use of record syntax. Using lens creates a space leak.
|
||||
-- | Note the explict use of record syntax. Using lens created a space leak.
|
||||
resetWorldEvents :: World -> World
|
||||
resetWorldEvents w = w {_worldEvents = id}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user