Refactor material sounds
This commit is contained in:
+3
-12
@@ -1,7 +1,7 @@
|
||||
module Dodge.Block where
|
||||
import Dodge.Data
|
||||
import Dodge.Material
|
||||
--import Dodge.Block.Debris
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Zone
|
||||
import Dodge.WorldEvent.Sound
|
||||
import Dodge.Wall.Delete
|
||||
@@ -18,13 +18,13 @@ import Control.Lens
|
||||
|
||||
splinterBlock :: Block -> World -> World
|
||||
splinterBlock bl w = foldr unshadowBlock w (_blShadows bl) -- foldr shiftTowardCen w (_blWallIDs bl)
|
||||
& matSplintSound bm cen
|
||||
& originsIDsAt [MaterialSound bm 0,MaterialSound bm 1,MaterialSound bm 2]
|
||||
(weakenMatS bm) (_blPos bl)
|
||||
where
|
||||
bm = fromMaybe Stone $ do
|
||||
wlids <- w ^? blocks . ix (_blID bl) . blWallIDs
|
||||
(wlid,_) <- IS.minView wlids
|
||||
w ^? walls . ix wlid . wlMaterial
|
||||
cen = centroid $ fst . _wlLine <$> IM.restrictKeys (_walls w) (_blWallIDs bl)
|
||||
|
||||
unshadowBlock :: Int -> World -> World
|
||||
unshadowBlock wlid w = case w ^? walls . ix wlid of
|
||||
@@ -35,15 +35,6 @@ unshadowBlock wlid w = case w ^? walls . ix wlid of
|
||||
(x,y) = zoneOfPoint $ uncurry pHalf (_wlLine wl)
|
||||
Nothing -> w
|
||||
|
||||
matSplintSound :: Material -> Point2 -> World -> World
|
||||
matSplintSound mat = case mat of
|
||||
Glass -> mkSoundSplinterGlass
|
||||
Stone -> mkSoundSplinterBlock
|
||||
Crystal -> mkSoundSplinterBlock
|
||||
Dirt -> originIDsAt (BlockDegradeSound 1) [impact1S,impact3S]
|
||||
Wood -> originIDsAt (BlockDegradeSound 1) [impact1S,impact2S,impact3S]
|
||||
Metal -> originIDsAt (BlockDegradeSound 1) [impact2S,impact3S]
|
||||
|
||||
checkBlockHP :: Block -> World -> World
|
||||
checkBlockHP bl
|
||||
| _blHP bl < 1 = destroyBlock bl
|
||||
|
||||
Reference in New Issue
Block a user