Tweak shell spin

This commit is contained in:
2025-01-08 22:07:04 +00:00
parent d952bd48cc
commit c355fe4f5f
9 changed files with 179 additions and 173 deletions
+5
View File
@@ -42,6 +42,7 @@ createShell mdetonator mscreen stab pjtype payload muz cr w =
, _pjID = i
, _pjDir = dir
, _pjSpin = 0
, _pjSpinFactor = spinfactor
, _pjPayload = payload
, _pjTimer = lifespan
, _pjUpdates =
@@ -61,6 +62,10 @@ createShell mdetonator mscreen stab pjtype payload muz cr w =
Just StabOrthReduce -> []
Just StabSpinIncrease -> [StartSpinPU (lifespan - 15) (_crID cr) 4]
_ -> [StartSpinPU (lifespan - 15) (_crID cr) 2]
spinfactor = case stab of
Just StabOrthReduce -> 0
Just StabSpinIncrease -> 2
_ -> 1
speed = case pjtype of
Grenade{} -> 4
Rocket{} -> 1
+13 -6
View File
@@ -28,7 +28,7 @@ updateProjectile :: Projectile -> World -> World
updateProjectile pj w =
(cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjTimer -~ 1)
. shellCollisionCheck pj
. pjMovement pj
. moveProjectile pj
. doGravityPU pj
$ foldl' (flip $ upProjectile pj) w (_pjUpdates pj)
@@ -202,18 +202,24 @@ pjRemoteSetDirection ph pj w = case ph of
Just (HomeUsingRemoteScreen screenid)
| lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
== lw ^? itemLocations . ix (_unNInt screenid) . ilInvID ->
w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjDir
.~ (w ^. wCam . camRot) + argV (w ^. input . mousePos)
w
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjDir
.~ (w ^. wCam . camRot) + argV (w ^. input . mousePos)
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjSpin
.~ 0.5 * diffAngles ((w ^. wCam . camRot) + argV (w ^. input . mousePos)) (_pjDir pj)
Just (HomeUsingTargeting itid)
| Just tp <- w ^? pointerToItemID itid . itTargeting . itTgPos . _Just ->
w & cWorld . lWorld . projectiles . ix (_pjID pj) . pjDir
%~ turnTo 0.2 (_pjPos pj) tp
& cWorld . lWorld . projectiles . ix (_pjID pj) . pjSpin
.~ 0.5 * diffAngles (turnTo 0.2 (_pjPos pj) tp (_pjDir pj)) (_pjDir pj)
_ -> w
where
lw = w ^. cWorld . lWorld
pjMovement :: Projectile -> World -> World
pjMovement pj w
moveProjectile :: Projectile -> World -> World
moveProjectile pj w
| Just GStuckWall{} <- pj ^? pjType . gnHitEffect = w
| Just (GStuckCreature crid p d) <- pj ^? pjType . gnHitEffect
, Just cr <- w ^? cWorld . lWorld . creatures . ix crid =
@@ -233,7 +239,8 @@ pjMovement pj w
w
& cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjSpin *~ 0.99
& cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjPos +~ _pjVel pj
& cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjDir +~ _pjSpin pj
& cWorld . lWorld . projectiles . ix (pj ^. pjID) . pjDir +~
(_pjSpin pj * _pjSpinFactor pj)
explodeShell ::
Projectile ->