Tweak shell spin
This commit is contained in:
@@ -20,6 +20,7 @@ data Projectile
|
||||
, _pjVel :: Point2
|
||||
, _pjDir :: Float
|
||||
, _pjSpin :: Float
|
||||
, _pjSpinFactor :: Float
|
||||
, _pjID :: Int
|
||||
, _pjPayload :: Payload
|
||||
, _pjTimer :: Int
|
||||
|
||||
+11
-18
@@ -1,33 +1,26 @@
|
||||
module Dodge.Movement.Turn where
|
||||
module Dodge.Movement.Turn (
|
||||
turnTo,
|
||||
vecTurnTo,
|
||||
) where
|
||||
|
||||
import Geometry
|
||||
|
||||
turnTo :: Float -> Point2 -> Point2 -> Float -> Float
|
||||
turnTo turnSpeed sp tp a
|
||||
| vToTarg == V2 0 0 = a
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= argV vToTarg
|
||||
| angleVV vToTarg vdir <= turnSpeed =
|
||||
argV vToTarg
|
||||
| isLHS (sp +.+ vdir) sp tp = a - turnSpeed
|
||||
| otherwise = a + turnSpeed
|
||||
where
|
||||
vdir = unitVectorAtAngle a
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
turnToAmount :: Float -> Point2 -> Point2 -> Float -> Float
|
||||
turnToAmount turnSpeed sp tp a
|
||||
| vToTarg == V2 0 0 = 0
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= diffAngles a (argV vToTarg) -- TODO check correctness
|
||||
| isLHS (sp +.+ vdir) sp tp = negate turnSpeed
|
||||
| otherwise = turnSpeed
|
||||
| otherwise = a + turnSpeed
|
||||
where
|
||||
vdir = unitVectorAtAngle a
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
vecTurnTo :: Float -> Point2 -> Point2 -> Point2 -> Point2
|
||||
vecTurnTo turnSpeed sp tp vdir
|
||||
| angleVV vToTarg vdir <= turnSpeed
|
||||
= magV vdir *.* normalizeV vToTarg
|
||||
| angleVV vToTarg vdir <= turnSpeed =
|
||||
magV vdir *.* normalizeV vToTarg
|
||||
| isLHS (sp +.+ vdir) sp tp = rotateV (negate turnSpeed) vdir
|
||||
| otherwise = rotateV turnSpeed vdir
|
||||
| otherwise = rotateV turnSpeed vdir
|
||||
where
|
||||
vToTarg = tp -.- sp
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module Dodge.Room.LasTurret where
|
||||
|
||||
import Dodge.Item.Held.Cane
|
||||
--import Dodge.Item.Held.Cane
|
||||
import qualified Data.Set as S
|
||||
import Dodge.Cleat
|
||||
import Dodge.Data.GenWorld
|
||||
@@ -24,8 +24,8 @@ import RandomHelp
|
||||
cenLasTur :: Room
|
||||
cenLasTur =
|
||||
roomNgon 8 200 & rmPmnts
|
||||
-- .~ [ putLasTurret 0.02
|
||||
.~ [ putTurret autoRifle 0.02
|
||||
.~ [ putLasTurret 0.02
|
||||
-- .~ [ putTurret autoRifle 0.02
|
||||
, heightWallPS (resetPLUse $ rprBoolShift (const . isInLnk) (shiftInBy 100)) 30 covershape
|
||||
, mntLightLnkCond $ rprBool $ const . isInLnk
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user