Add sound on spawn, allow for filtering of to play sounds

This commit is contained in:
2025-12-05 23:19:06 +00:00
parent a4f8369420
commit f9ce58b409
19 changed files with 752 additions and 695 deletions
+3 -4
View File
@@ -8,7 +8,6 @@ module Dodge.WorldEvent.Explosion (
makeTeslaExplosionAt,
) where
import Linear
import Control.Monad
import Data.List
import Dodge.Data.World
@@ -18,6 +17,7 @@ import Dodge.WorldEvent.Shockwave
import Dodge.WorldEvent.SpawnParticle
import Geometry
import LensHelp
import Linear
import Picture
import RandomHelp
@@ -70,12 +70,11 @@ makeExplosionAt p vel w =
w
& soundStart (Explosion (w ^. cWorld . lWorld . lClock)) (p ^. _xy) bangS Nothing
& addFlames
& cWorld . lWorld . worldEvents
.:~ MakeTempLight (LSParam p 150 (V3 1 0.5 0)) 20
& cWorld . lWorld . worldEvents .:~ MakeTempLight (LSParam p 150 (V3 1 0.5 0)) 20
& makeShockwaveAt [] p 50 100 1 white
where
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 8) & evalState $ _randGen w
fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
fdamps = replicateM 100 (state $ randomR (0, 1)) & evalState $ _randGen w
sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w
mF v damp size time = makeFlamelet p (v + damp *^ vel) size time