Move sparks into dedicated datatype

This commit is contained in:
2022-07-18 12:15:05 +01:00
parent 13f2255ba7
commit 5495d33389
16 changed files with 99 additions and 104 deletions
+7
View File
@@ -5,6 +5,7 @@ Description : Simulation update
-}
module Dodge.Update ( updateUniverse ) where
import Dodge.Data
import Dodge.Spark
import Dodge.Bullet
import Dodge.Update.Cloud
import Dodge.Machine.Update
@@ -81,6 +82,7 @@ functionalUpdate cfig w = checkEndGame
. resetWorldEvents
. dbArg _worldEvents
. updateIMl _modifications _mdUpdate
. updateSparks
. updateParticles
. updateBullets
. updateRadarBlips
@@ -220,6 +222,11 @@ updateBullets w = updateInstantBullets $ set bullets (catMaybes ps) w'
where
(w',ps) = mapAccumR updateBullet w $ _bullets w
updateSparks :: World -> World
updateSparks w = w' & sparks .~ catMaybes newsparks
where
(w',newsparks) = mapAccumR (\a b -> moveSpark a b) w $ _sparks w
{- Apply internal particle updates, delete 'Nothing's. -}
updateParticles :: World -> World
updateParticles w = updateInstantParticles $ set particles (catMaybes ps) w'