diff --git a/src/Dodge/Bullet.hs b/src/Dodge/Bullet.hs index 5fb21efe7..4b024b5a2 100644 --- a/src/Dodge/Bullet.hs +++ b/src/Dodge/Bullet.hs @@ -21,7 +21,6 @@ import Data.Bifunctor updateBullet :: World -> Bullet -> (World, Maybe Bullet) updateBullet w bu --- | magV (_buVel bu) < 1 || _buTimer bu <= 0 = (endspawn w, Nothing) | magV (_buVel bu) < 1 = (endspawn w, Nothing) | otherwise = second (fmap updateBulVel) @@ -208,7 +207,6 @@ moveBullet pt = pt & buPos %~ (+.+ _buVel pt) & buOldPos .~ _buPos pt --- & buTimer -~ 1 destroyAt :: Point2 -> Bullet -> Maybe Bullet destroyAt hitp pt = diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index f154f31f5..7c15b961e 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -541,12 +541,13 @@ updateDistortions = updateObjMapMaybe distortions updateDistortion updateRadarBlips :: World -> World updateRadarBlips = updateObjMapMaybe radarBlips updateRadarBlip -{- Apply internal particle updates, delete 'Nothing's. -} +-- if changing, make sure that bullets can still spawn new bullets updateBullets :: World -> World ---updateBullets w = updateInstantBullets $ set (cWorld . lWorld . bullets) (catMaybes ps) w' -updateBullets w = set (cWorld . lWorld . bullets) (catMaybes ps) w' +updateBullets w = w' + & cWorld . lWorld . bullets %~ (++ catMaybes ps) where - (w', ps) = mapAccumR updateBullet w $ w ^. cWorld . lWorld . bullets + (w', ps) = mapAccumR updateBullet (w & cWorld . lWorld . bullets .~ []) + $ w ^. cWorld . lWorld . bullets updateTeslaArcs :: World -> World updateTeslaArcs = updateObjCatMaybes teslaArcs updateTeslaArc