Simplify explosions
This commit is contained in:
@@ -53,7 +53,6 @@ makeTeslaExplosionAt = undefined
|
||||
-- [1 .. 29]
|
||||
|
||||
makeFlameExplosionAt ::
|
||||
-- | Position
|
||||
Point2 ->
|
||||
World ->
|
||||
World
|
||||
@@ -66,9 +65,6 @@ makeFlameExplosionAt p w =
|
||||
velocities = replicateM 15 (randInCirc 1) & evalState $ _randGen w
|
||||
timers = randomRs (80, 100) $ _randGen w
|
||||
|
||||
-- the ( Nthing :: Maybe Int ) here is "maybe" a creature id that the
|
||||
-- particle passes through for the first frame of its existence
|
||||
|
||||
makeExplosionAt :: Point3 -> Point3 -> World -> World
|
||||
makeExplosionAt p vel w =
|
||||
w
|
||||
@@ -78,15 +74,10 @@ makeExplosionAt p vel w =
|
||||
.:~ MakeTempLight (LSParam p 150 (V3 1 0.5 0)) 20
|
||||
& makeShockwaveAt [] p 50 100 1 white
|
||||
where
|
||||
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
|
||||
fPs' = fmap (`v2z` 0) $ replicateM 100 (randInCirc 5) & evalState $ _randGen w
|
||||
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 8) & evalState $ _randGen w
|
||||
fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
|
||||
inversePushOut v = (15 - norm v) * 0.01 *^ v
|
||||
fVs' = zipWith (+.+.+) fVs $ map inversePushOut fPs'
|
||||
sizes = randomRs (2, 9) $ _randGen w
|
||||
times = randomRs (15, 20) $ _randGen w
|
||||
mF q v damp size time = makeFlamelet
|
||||
--(q - (2*v + 2* vel)) (v + damp *.*.* vel) size time
|
||||
(q - (2*v )) (v + damp *.*.* vel) size time
|
||||
newFs = zipWith4 (mF p) (zipWith (+) fPs' (fmap (3 *.*.*) fVs')) fdamps sizes times
|
||||
addFlames w' = foldl' (flip ($)) w' newFs
|
||||
mF v damp size time = makeFlamelet p (v + damp *^ vel) size time
|
||||
newFs = zipWith4 mF fVs fdamps sizes times
|
||||
addFlames w' = foldl' (&) w' newFs
|
||||
|
||||
Reference in New Issue
Block a user