Tweak "magnets" that affect bullet movement

This commit is contained in:
2024-12-24 10:48:28 +00:00
parent 02b2f9831f
commit fb1553bf3c
17 changed files with 226 additions and 257 deletions
+8 -4
View File
@@ -30,7 +30,6 @@ import Dodge.Laser.Update
import Dodge.LinearShockwave.Update
import Dodge.ListDisplayParams
import Dodge.Machine.Update
import Dodge.Magnet.Update
import Dodge.Menu
import Dodge.ModificationEffect
import Dodge.PosEvent
@@ -251,10 +250,12 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
_ <- w ^? timeFlow . scrollItemID . unNInt
return id -- pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
-- | The update step.
functionalUpdate :: Universe -> Universe
functionalUpdate u =
checkEndGame
. over (uvWorld . cWorld . lWorld) updateMagnets
. over uvWorld (cWorld . lWorld . lClock +~ 1)
. over uvWorld updateDistortions
. over uvWorld updateCreatureSoundPositions
@@ -282,7 +283,6 @@ functionalUpdate u =
. over uvWorld (updateIMl' (_projectiles . _lWorld . _cWorld) updateProjectile)
. over uvWorld updateClouds
. over uvWorld updateGusts
. over uvWorld (updateMIM (cWorld . lWorld . magnets) (doMagnetUpdate . _mgUpdate))
. over uvWorld (updateIMl' (_terminals . _lWorld . _cWorld) tmUpdate)
-- . updateIMl _machines mcChooseUpdate
. over uvWorld (updateIMl' (_machines . _lWorld . _cWorld) updateMachine)
@@ -304,6 +304,10 @@ functionalUpdate u =
. set (uvWorld . cWorld . lWorld . lights) []
$ over uvWorld updatePastWorlds u
updateMagnets :: LWorld -> LWorld
updateMagnets lw = lw & oldMagnets .~ (lw ^. magnets)
& magnets .~ mempty
checkTermDist :: World -> World
checkTermDist w = fromMaybe w $ do
tmid <- w ^? hud . hudElement . subInventory . termID
@@ -657,8 +661,8 @@ updateInstantBullets w = case w ^. cWorld . lWorld . instantBullets of
-- ps -> let (w',ps') = mapAccumR (\a b -> _ptUpdate b a b) (w {_instantParticles=[]}) ps
-- in updateInstantParticles $ w' & particles .++~ catMaybes ps'
updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> World
updateMIM f up = f %~ IM.mapMaybe (dbArg up)
--updateMIM :: ASetter' World (IM.IntMap a) -> (a -> a -> Maybe a) -> World -> World
--updateMIM f up = f %~ IM.mapMaybe (dbArg up)
-- Note that this updates the randgen
--updateCreatures :: World -> World