Add wall dust when destroying a block
This commit is contained in:
@@ -55,7 +55,7 @@ wpAdd wp = rmPmnts %~ f
|
|||||||
g x = x & plIDCont .~ flickerMod
|
g x = x & plIDCont .~ flickerMod
|
||||||
|
|
||||||
-- TODO move this to a sensible place
|
-- TODO move this to a sensible place
|
||||||
-- Supposes the orginal placement is a light source, adds a flickermod
|
-- Supposes the orginal placement is a light source, adds a flicker
|
||||||
flickerMod :: Placement -> Maybe Placement
|
flickerMod :: Placement -> Maybe Placement
|
||||||
flickerMod pl = Just $ sps0 $ PutMod $ ModIDTimerPoint3Bool
|
flickerMod pl = Just $ sps0 $ PutMod $ ModIDTimerPoint3Bool
|
||||||
{ _mdID = 0
|
{ _mdID = 0
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import Dodge.SoundLogic
|
|||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
import Dodge.WorldEvent.Sound
|
import Dodge.WorldEvent.Sound
|
||||||
import Dodge.Wall.Delete
|
import Dodge.Wall.Delete
|
||||||
|
import Dodge.Wall.Dust
|
||||||
|
import Dodge.RandomHelp
|
||||||
import Geometry
|
import Geometry
|
||||||
import Geometry.ConvexPoly
|
import Geometry.ConvexPoly
|
||||||
import Geometry.Vector3D
|
import Geometry.Vector3D
|
||||||
@@ -28,6 +30,8 @@ import qualified Data.Set as S
|
|||||||
import qualified Data.IntSet as IS
|
import qualified Data.IntSet as IS
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
import Control.Monad
|
||||||
|
import Control.Monad.State
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import System.Random
|
import System.Random
|
||||||
|
|
||||||
@@ -121,9 +125,12 @@ destroyBlock bl w = w
|
|||||||
& deleteWallIDs wlids
|
& deleteWallIDs wlids
|
||||||
& blocks %~ IM.delete (_blID bl)
|
& blocks %~ IM.delete (_blID bl)
|
||||||
& mkSoundBreakGlass pos
|
& mkSoundBreakGlass pos
|
||||||
|
& flip (foldr (wlDustAt awl)) (map (pos +.+) ps)
|
||||||
where
|
where
|
||||||
wlids = _blWallIDs bl
|
wlids = _blWallIDs bl
|
||||||
|
awl = _walls w IM.! IS.findMin wlids
|
||||||
pos = fst . _wlLine $ _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.
|
-- | Note the explict use of record syntax. Using lens created a space leak.
|
||||||
resetWorldEvents :: World -> World
|
resetWorldEvents :: World -> World
|
||||||
resetWorldEvents w = w {_worldEvents = id}
|
resetWorldEvents w = w {_worldEvents = id}
|
||||||
|
|||||||
@@ -6,11 +6,10 @@ module Dodge.Wall.Damage
|
|||||||
, damageWall
|
, damageWall
|
||||||
) where
|
) where
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.WorldEvent.Cloud
|
|
||||||
import Dodge.Wall.Reflect
|
import Dodge.Wall.Reflect
|
||||||
|
import Dodge.Wall.Dust
|
||||||
import Dodge.Particle.Spark
|
import Dodge.Particle.Spark
|
||||||
import Geometry
|
import Geometry
|
||||||
import Geometry.Vector3D
|
|
||||||
import Color
|
import Color
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -26,8 +25,8 @@ wallEff :: DamageType -> Wall -> World -> World
|
|||||||
wallEff dt wl = case dt of
|
wallEff dt wl = case dt of
|
||||||
Lasering _ sp p _ -> colSpark 8 lSparkCol (outTo sp p) (reflDirWall sp p wl)
|
Lasering _ sp p _ -> colSpark 8 lSparkCol (outTo sp p) (reflDirWall sp p wl)
|
||||||
Piercing _ sp p _ -> colSpark' 0.2 8 pSparkCol (outTo sp p) (reflDirWall sp p wl)
|
Piercing _ sp p _ -> colSpark' 0.2 8 pSparkCol (outTo sp p) (reflDirWall sp p wl)
|
||||||
. smokeCloudAt dustcol 20 200 1 (addZ 20 (outTo sp p))
|
. wlDustAt wl (outTo sp p)
|
||||||
Blunt _ sp p _ -> smokeCloudAt dustcol 20 200 1 (addZ 20 (outTo sp p))
|
Blunt _ sp p _ -> wlDustAt wl (outTo sp p)
|
||||||
Cutting {} -> id
|
Cutting {} -> id
|
||||||
SparkDam {} -> id
|
SparkDam {} -> id
|
||||||
Flaming {} -> id
|
Flaming {} -> id
|
||||||
@@ -38,7 +37,6 @@ wallEff dt wl = case dt of
|
|||||||
PoisonDam {} -> id
|
PoisonDam {} -> id
|
||||||
where
|
where
|
||||||
outTo sp p = p +.+ safeNormalizeV (sp -.- p)
|
outTo sp p = p +.+ safeNormalizeV (sp -.- p)
|
||||||
dustcol = _wlColor wl & _4 .~ 1
|
|
||||||
pSparkCol = brightX 100 1.5 white
|
pSparkCol = brightX 100 1.5 white
|
||||||
lSparkCol = V4 20 (-5) 0 1
|
lSparkCol = V4 20 (-5) 0 1
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
module Dodge.Wall.Dust where
|
||||||
|
import Dodge.Data
|
||||||
|
import Dodge.WorldEvent.Cloud
|
||||||
|
import Geometry
|
||||||
|
import Geometry.Vector3D
|
||||||
|
import Control.Lens
|
||||||
|
|
||||||
|
wlDustAt :: Wall -> Point2 -> World -> World
|
||||||
|
wlDustAt wl p = smokeCloudAt dustcol 20 200 1 (addZ 20 p)
|
||||||
|
where
|
||||||
|
dustcol = _wlColor wl & _4 .~ 1
|
||||||
|
|
||||||
Reference in New Issue
Block a user