Refactor creature zoning
This commit is contained in:
+23
-22
@@ -4,6 +4,7 @@ Module : Dodge.Update
|
||||
Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update ( updateUniverse ) where
|
||||
import Dodge.Zoning.Creature
|
||||
import Dodge.WorldEffect
|
||||
import Dodge.Data
|
||||
import Dodge.Beam
|
||||
@@ -73,28 +74,28 @@ functionalUpdate w = over uvWorld checkEndGame
|
||||
. over uvWorld ppEvents
|
||||
. updateCamera
|
||||
. colCrsWalls
|
||||
. over uvWorld (simpleCrSprings )
|
||||
. over uvWorld (zoneCreatures )
|
||||
. over uvWorld simpleCrSprings
|
||||
. over uvWorld zoneCreatures
|
||||
. over uvWorld (updateIMl _doors _drMech )
|
||||
. over uvWorld doWorldEvents
|
||||
. over uvWorld (updateDelayedEvents )
|
||||
. over uvWorld updateDelayedEvents
|
||||
. over uvWorld (updateIMl _modifications _mdUpdate )
|
||||
. over uvWorld (updateSparks )
|
||||
. over uvWorld (updateRadarSweeps )
|
||||
. over uvWorld (updatePosEvents )
|
||||
. over uvWorld (updateFlames )
|
||||
. over uvWorld (updateEnergyBalls )
|
||||
. over uvWorld (updateParticles )
|
||||
. over uvWorld (updateBullets )
|
||||
. over uvWorld (updateRadarBlips )
|
||||
. over uvWorld (updateFlares )
|
||||
. over uvWorld (updateBeams )
|
||||
. over uvWorld updateSparks
|
||||
. over uvWorld updateRadarSweeps
|
||||
. over uvWorld updatePosEvents
|
||||
. over uvWorld updateFlames
|
||||
. over uvWorld updateEnergyBalls
|
||||
. over uvWorld updateParticles
|
||||
. over uvWorld updateBullets
|
||||
. over uvWorld updateRadarBlips
|
||||
. over uvWorld updateFlares
|
||||
. over uvWorld updateBeams
|
||||
. over uvWorld (updateIMl _props _pjUpdate )
|
||||
. over uvWorld (updateIMl' _projectiles updateProjectile)
|
||||
. over uvWorld (updateLightSources )
|
||||
. over uvWorld (updateClouds )
|
||||
. over uvWorld (updateGusts )
|
||||
. over uvWorld (zoneClouds )
|
||||
. over uvWorld updateLightSources
|
||||
. over uvWorld updateClouds
|
||||
. over uvWorld updateGusts
|
||||
. over uvWorld zoneClouds
|
||||
. over uvWorld (updateMIM magnets _mgUpdate )
|
||||
. over uvWorld (updateIMl' _terminals tmUpdate )
|
||||
-- . updateIMl _machines mcChooseUpdate
|
||||
@@ -173,10 +174,10 @@ doRewind w = case _maybeWorld w of
|
||||
|
||||
zoneCreatures :: World -> World
|
||||
zoneCreatures w = w
|
||||
& crZoning . znObjects .~ mempty
|
||||
& crZoning %~ \zn ->
|
||||
foldl' (flip $ updateZoning (\cr -> IM.insert (_crID cr) cr))
|
||||
zn (_creatures w)
|
||||
& crZoning . getCrZoning .~ mempty
|
||||
& crZoning %~ \zn -> foldl' (flip zoneCreature) zn (_creatures w)
|
||||
-- foldl' (flip $ updateZoning (\cr -> IM.insert (_crID cr) cr))
|
||||
-- zn (_creatures w)
|
||||
|
||||
updateCreatureSoundPositions :: World -> World
|
||||
updateCreatureSoundPositions w = M.foldlWithKey' insertSound w
|
||||
@@ -428,7 +429,7 @@ simpleCrSprings w = IM.foldl' (flip crSpring) w $ _creatures w
|
||||
|
||||
-- note that this may in rare cases not push creatures away from each other
|
||||
crSpring :: Creature -> World -> World
|
||||
crSpring c w = runIdentity $ S.fold_ (flip $ crCrSpring c) w id cs
|
||||
crSpring c w = foldl' (flip $ crCrSpring c) w cs
|
||||
where
|
||||
cs = crsNearPoint (_crPos c) w
|
||||
|
||||
|
||||
Reference in New Issue
Block a user