Add trajectory to grenades, various refactoring

This commit is contained in:
2021-09-25 18:39:53 +01:00
parent a0340eb024
commit 32367b5b2d
32 changed files with 339 additions and 253 deletions
+6 -6
View File
@@ -118,12 +118,12 @@ updateTriggers w
cr = _creatures w IM.! 0 & crPos .~ V2 0 0
updateLightSources :: World -> World
updateLightSources w = set tempLightSources tlss w
updateLightSources w = over tempLightSources f w
where
tlss = mapMaybe (\b -> _tlsUpdate b w b) $ _tempLightSources w
f = mapMaybe (\b -> _tlsUpdate b w b)
updateProjectiles :: World -> World
updateProjectiles w = IM.foldl' (flip $ dbArg _pjUpdate) w $ _projectiles w
updateProjectiles w = IM.foldl' (flip $ dbArg _pjUpdate) w $ _props w
{-
Apply internal particle updates, delete 'Nothing's. -}
updateParticles :: World -> World
@@ -151,7 +151,7 @@ ppEvents :: World -> World
ppEvents w = IM.foldl' (flip $ \pp w' -> _ppEvent pp pp w') w $ _pressPlates w
updateSeenWalls :: World -> World
updateSeenWalls w = foldr markSeen w wallsToUpdate
updateSeenWalls w = foldl' (flip markSeen) w wallsToUpdate
where
vPos = _cameraViewFrom w
wallsToUpdate = concatMap (\p -> visibleWalls vPos (vPos +.+p) $ wallsAlongLine vPos (vPos +.+ p) w)
@@ -224,10 +224,10 @@ clClSpringVel a v b
radDist = (_clRad a + _clRad b) / 2
simpleCrSprings :: World -> World
simpleCrSprings w = IM.foldr crSpring w $ _creatures w
simpleCrSprings w = IM.foldl' (flip crSpring) w $ _creatures w
crSpring :: Creature -> World -> World
crSpring c w = IM.foldr (crCrSpring c) w cs
crSpring c w = IM.foldl' (flip $ crCrSpring c) w cs
where
cs = creaturesNearPoint (_crPos c) w