Add wall dust when destroying a block
This commit is contained in:
@@ -16,6 +16,8 @@ import Dodge.SoundLogic
|
||||
import Dodge.Inventory
|
||||
import Dodge.WorldEvent.Sound
|
||||
import Dodge.Wall.Delete
|
||||
import Dodge.Wall.Dust
|
||||
import Dodge.RandomHelp
|
||||
import Geometry
|
||||
import Geometry.ConvexPoly
|
||||
import Geometry.Vector3D
|
||||
@@ -28,6 +30,8 @@ import qualified Data.Set as S
|
||||
import qualified Data.IntSet as IS
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Control.Monad.State
|
||||
import Data.Monoid
|
||||
import System.Random
|
||||
|
||||
@@ -121,9 +125,12 @@ destroyBlock bl w = w
|
||||
& deleteWallIDs wlids
|
||||
& blocks %~ IM.delete (_blID bl)
|
||||
& mkSoundBreakGlass pos
|
||||
& flip (foldr (wlDustAt awl)) (map (pos +.+) ps)
|
||||
where
|
||||
wlids = _blWallIDs bl
|
||||
awl = _walls w IM.! IS.findMin wlids
|
||||
pos = fst . _wlLine $ _walls w IM.! IS.findMin wlids
|
||||
ps = (replicateM 25 $ randInCirc 20) & evalState $ _randGen w
|
||||
-- | 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