Allow bullets to spawn bullets

This commit is contained in:
2024-12-24 14:17:36 +00:00
parent dc96424de9
commit a79dfa1bb3
2 changed files with 5 additions and 6 deletions
-2
View File
@@ -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 =
+5 -4
View File
@@ -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