Tweak ordering of projectile movement
This commit is contained in:
@@ -25,9 +25,8 @@ import RandomHelp
|
||||
updateProjectile :: Projectile -> World -> World
|
||||
updateProjectile pj w =
|
||||
(cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjTimer -~ 1)
|
||||
. shellCollisionCheck pj
|
||||
. pjMovement pj
|
||||
. shellCollisionCheck
|
||||
pj
|
||||
. doGravityPU pj
|
||||
$ foldl' (flip $ upProjectile pj) w (_pjUpdates pj)
|
||||
|
||||
@@ -43,8 +42,6 @@ upProjectile pj pu = case pu of
|
||||
| act st et -> pjRemoteSetDirection (pj ^? pjType . rkHoming) pj
|
||||
| otherwise -> id
|
||||
where
|
||||
-- ApplyGravityPU -> applyGravityPU pj
|
||||
|
||||
time = _pjTimer pj
|
||||
act st et = time <= st && time >= et
|
||||
|
||||
@@ -91,15 +88,13 @@ shellCollisionCheck pj w
|
||||
| RetiredProjectile <- pj ^. pjType
|
||||
, time <= 0 =
|
||||
destroyProjectile (pj ^. pjScreenID) (_pjID pj) w
|
||||
| time <= 0 = g
|
||||
| time <= 0 = explodeShell pj w
|
||||
| RetiredProjectile <- pj ^. pjType = w
|
||||
| Just thit <- thingHit oldPos (oldPos + _pjVel pj) w = tryShellBounce thit pj w
|
||||
-- | anythingHitCirc 2 oldPos (oldPos + _pjVel pj) w = g
|
||||
| Just thit <- thingHit oldpos (oldpos + _pjVel pj) w = tryShellBounce thit pj w
|
||||
| otherwise = w
|
||||
where
|
||||
g = explodeShell pj w
|
||||
time = _pjTimer pj
|
||||
oldPos = _pjPos pj
|
||||
oldpos = _pjPos pj
|
||||
|
||||
-- note this doesn't take into account moving walls, which may break the
|
||||
-- bouncing in some way
|
||||
@@ -111,17 +106,17 @@ tryShellBounce (p, Right wl) pj w
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjType
|
||||
.~ Grenade (GStuckWall (wl ^. wlStructure))
|
||||
-- & cWorld . lWorld . projectiles . ix (_pjID pj) . pjUpdates %~ delete ApplyGravityPU
|
||||
& soundOriginIDsAt (ShellSound (pj ^. pjID)) [slapS, slap1S] (pj ^. pjPos)
|
||||
| Just x <- pj ^? pjType . gnHitEffect . bounceTolerance =
|
||||
if abs (dotV (pj ^. pjVel) (vNormal hitline)) < x
|
||||
then
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjVel
|
||||
%~ reflectIn hitline
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjPos .~ p
|
||||
& soundStart (ShellSound (pj ^. pjID)) (pj ^. pjPos) click1S Nothing
|
||||
else explodeShell pj w
|
||||
| Just x <- pj ^? pjType . gnHitEffect . bounceTolerance
|
||||
, abs (dotV (pj ^. pjVel) (vNormal hitline)) < x =
|
||||
w
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjVel
|
||||
%~ reflectIn hitline
|
||||
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjPos
|
||||
.~ p - normalizeV (pj ^. pjVel)
|
||||
& soundStart (ShellSound (pj ^. pjID)) (pj ^. pjPos) click1S Nothing
|
||||
| isJust $ pj ^? pjType . gnHitEffect . bounceTolerance =
|
||||
explodeShell pj w
|
||||
where
|
||||
hitline = normalizeV $ uncurry (-) $ _wlLine wl
|
||||
tryShellBounce (p, Left cr) pj w
|
||||
|
||||
Reference in New Issue
Block a user