Add gimbal and gyroscope, allowing more fine tuned projectile control
This commit is contained in:
@@ -240,7 +240,9 @@ inventoryX c = case c of
|
|||||||
'U' ->
|
'U' ->
|
||||||
[targetingScope tt | tt <- [minBound .. maxBound]]
|
[targetingScope tt | tt <- [minBound .. maxBound]]
|
||||||
<>
|
<>
|
||||||
[ battery
|
[ gyroscope
|
||||||
|
, gimbal
|
||||||
|
, battery
|
||||||
, laser
|
, laser
|
||||||
, augmentedHUD
|
, augmentedHUD
|
||||||
, rLauncher
|
, rLauncher
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ data ComposeLinkType
|
|||||||
| AugmentedHUDLink
|
| AugmentedHUDLink
|
||||||
| FunctionChangeLink
|
| FunctionChangeLink
|
||||||
| MakeAutoLink
|
| MakeAutoLink
|
||||||
|
| ProjectileStabiliserLink
|
||||||
deriving (Eq, Ord, Show, Read)
|
deriving (Eq, Ord, Show, Read)
|
||||||
|
|
||||||
data ItemStructuralFunction
|
data ItemStructuralFunction
|
||||||
@@ -52,6 +53,7 @@ data ItemStructuralFunction
|
|||||||
| AmmoEffectSF AmmoType
|
| AmmoEffectSF AmmoType
|
||||||
| FunctionChangeSF
|
| FunctionChangeSF
|
||||||
| MakeAutoSF
|
| MakeAutoSF
|
||||||
|
| ProjectileStabiliserSF
|
||||||
deriving (Eq, Ord, Show, Read)
|
deriving (Eq, Ord, Show, Read)
|
||||||
|
|
||||||
type ComposedItem = (Item, ItemStructuralFunction, LinkTest)
|
type ComposedItem = (Item, ItemStructuralFunction, LinkTest)
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ data AttachType
|
|||||||
| BULLETSYNTH
|
| BULLETSYNTH
|
||||||
| REMOTESCREEN
|
| REMOTESCREEN
|
||||||
| JOYSTICK
|
| JOYSTICK
|
||||||
|
| GIMBAL
|
||||||
|
| GYROSCOPE
|
||||||
| REMOTEDETONATOR
|
| REMOTEDETONATOR
|
||||||
| SMOKEREDUCER
|
| SMOKEREDUCER
|
||||||
| HOMINGMODULE
|
| HOMINGMODULE
|
||||||
|
|||||||
+15
-3
@@ -300,7 +300,8 @@ useLoadedAmmo itmtree cr (cme, w) (mzid, Just (mz, x, magtree)) = (,) (cme & cme
|
|||||||
MuzzleTesla -> shootTeslaArc itm cr mz w
|
MuzzleTesla -> shootTeslaArc itm cr mz w
|
||||||
MuzzleTractor -> shootTractorBeam cr w
|
MuzzleTractor -> shootTractorBeam cr w
|
||||||
MuzzleRLauncher -> createProjectileR itmtree magtree mz cr w
|
MuzzleRLauncher -> createProjectileR itmtree magtree mz cr w
|
||||||
MuzzleGLauncher -> createProjectile (Grenade (GBounce 2)) magtree mz cr w
|
MuzzleGLauncher -> createProjectile (Grenade (GBounce 2)) magtree
|
||||||
|
(getPJStabiliser itmtree) mz cr w
|
||||||
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
MuzzleNozzle{} -> useGasParams mid mz itm cr $ walkNozzle mzid mz itm cr w
|
||||||
MuzzleShatter -> shootShatter itm cr w
|
MuzzleShatter -> shootShatter itm cr w
|
||||||
MuzzleDetector -> itemDetectorEffect itm cr w
|
MuzzleDetector -> itemDetectorEffect itm cr w
|
||||||
@@ -619,19 +620,30 @@ createProjectileR itmtree magtree =
|
|||||||
(determineProjectileTracking magtree itmtree)
|
(determineProjectileTracking magtree itmtree)
|
||||||
smoke
|
smoke
|
||||||
) magtree
|
) magtree
|
||||||
|
(getPJStabiliser itmtree)
|
||||||
where
|
where
|
||||||
smoke
|
smoke
|
||||||
| isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft) = Just ReducedRocketSmoke
|
| isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft) = Just ReducedRocketSmoke
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|
||||||
|
|
||||||
|
getPJStabiliser :: LabelDoubleTree ComposeLinkType Item -> Maybe PJStabiliser
|
||||||
|
getPJStabiliser ldt = case lookup ProjectileStabiliserLink (ldt ^. ldtRight) of
|
||||||
|
Just ldt' -> case ldt' ^? ldtValue . itType . ibtAttach of
|
||||||
|
Just GIMBAL -> Just StabOrthReduce
|
||||||
|
Just GYROSCOPE -> Just StabSpinIncrease
|
||||||
|
_ -> Nothing
|
||||||
|
_ -> Nothing
|
||||||
|
|
||||||
createProjectile ::
|
createProjectile ::
|
||||||
ProjectileType ->
|
ProjectileType ->
|
||||||
LabelDoubleTree ComposeLinkType Item ->
|
LabelDoubleTree ComposeLinkType Item ->
|
||||||
|
Maybe PJStabiliser ->
|
||||||
Muzzle ->
|
Muzzle ->
|
||||||
Creature ->
|
Creature ->
|
||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
createProjectile pjtype magtree muz cr = fromMaybe failsound $ do
|
createProjectile pjtype magtree stab muz cr = fromMaybe failsound $ do
|
||||||
magid <- magtree ^? ldtValue . itLocation . ilInvID
|
magid <- magtree ^? ldtValue . itLocation . ilInvID
|
||||||
ammoitem <- cr ^? crInv . ix magid
|
ammoitem <- cr ^? crInv . ix magid
|
||||||
let rdetonate = (^. ldtValue . itID) <$>
|
let rdetonate = (^. ldtValue . itID) <$>
|
||||||
@@ -641,7 +653,7 @@ createProjectile pjtype magtree muz cr = fromMaybe failsound $ do
|
|||||||
aparams <- ((magtree ^? ldtLeft) >>= lookup AmmoPayloadLink >>= (^? ldtValue . itType . ibtAttach . shellPayload))
|
aparams <- ((magtree ^? ldtLeft) >>= lookup AmmoPayloadLink >>= (^? ldtValue . itType . ibtAttach . shellPayload))
|
||||||
<|> ammoitem ^? itConsumables . magParams . ampPayload
|
<|> ammoitem ^? itConsumables . magParams . ampPayload
|
||||||
return $
|
return $
|
||||||
createShell rdetonate rscreen pjtype aparams muz cr
|
createShell rdetonate rscreen stab pjtype aparams muz cr
|
||||||
. startthesound
|
. startthesound
|
||||||
where
|
where
|
||||||
-- the sound should be moved to the projectile firing
|
-- the sound should be moved to the projectile firing
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ itemFromAttachType at = case at of
|
|||||||
BULLETSYNTH -> bulletSynthesizer
|
BULLETSYNTH -> bulletSynthesizer
|
||||||
REMOTESCREEN -> remoteScreen
|
REMOTESCREEN -> remoteScreen
|
||||||
JOYSTICK -> joystick
|
JOYSTICK -> joystick
|
||||||
|
GIMBAL -> gimbal
|
||||||
|
GYROSCOPE -> gyroscope
|
||||||
REMOTEDETONATOR -> remoteDetonator
|
REMOTEDETONATOR -> remoteDetonator
|
||||||
SMOKEREDUCER -> smokeReducer
|
SMOKEREDUCER -> smokeReducer
|
||||||
-- ROCKETHOMER -> rocketHomer
|
-- ROCKETHOMER -> rocketHomer
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ showAttachItem t = case t of
|
|||||||
HOMINGMODULE -> "HOMING MOD"
|
HOMINGMODULE -> "HOMING MOD"
|
||||||
AUGMENTEDHUD -> "AUGMENTED HUD"
|
AUGMENTEDHUD -> "AUGMENTED HUD"
|
||||||
SHELLPAYLOAD x -> show x
|
SHELLPAYLOAD x -> show x
|
||||||
|
GIMBAL -> "GIMBAL"
|
||||||
|
GYROSCOPE -> "GYROSCOPE"
|
||||||
|
|
||||||
showEquipItem :: EquipItemType -> String
|
showEquipItem :: EquipItemType -> String
|
||||||
showEquipItem eit = case eit of
|
showEquipItem eit = case eit of
|
||||||
|
|||||||
@@ -44,15 +44,17 @@ useBreakListsLinkTest llist rlist = LTest ltest rtest
|
|||||||
dropWhile
|
dropWhile
|
||||||
((\s -> not $ S.member s (structureToPotentialFunction ldt)) . fst)
|
((\s -> not $ S.member s (structureToPotentialFunction ldt)) . fst)
|
||||||
llist
|
llist
|
||||||
(_, linktype) <- safeHead xs
|
(sf, linktype) <- safeHead xs
|
||||||
return $ LUpdate linktype (set _3 (useBreakListsLinkTest (tail xs) rlist)) id
|
return $ LUpdate linktype (set _3 (useBreakListsLinkTest (tail xs) rlist))
|
||||||
|
(_2 .~ sf)
|
||||||
rtest ldt = do
|
rtest ldt = do
|
||||||
let xs =
|
let xs =
|
||||||
dropWhile
|
dropWhile
|
||||||
((\s -> not $ S.member s (structureToPotentialFunction ldt)) . fst)
|
((\s -> not $ S.member s (structureToPotentialFunction ldt)) . fst)
|
||||||
rlist
|
rlist
|
||||||
(_, linktype) <- safeHead xs
|
(sf, linktype) <- safeHead xs
|
||||||
return $ LUpdate linktype (set _3 (useBreakListsLinkTest llist (tail xs))) id
|
return $ LUpdate linktype (set _3 (useBreakListsLinkTest llist (tail xs)))
|
||||||
|
(_2 .~ sf)
|
||||||
|
|
||||||
itemToBreakLists ::
|
itemToBreakLists ::
|
||||||
Item ->
|
Item ->
|
||||||
@@ -64,6 +66,7 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
|||||||
( getAmmoLinks itm
|
( getAmmoLinks itm
|
||||||
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||||
<> getAutoSpringLinks itm
|
<> getAutoSpringLinks itm
|
||||||
|
<> extraWeaponLinks itm
|
||||||
)
|
)
|
||||||
(_, GadgetPlatformSF) ->
|
(_, GadgetPlatformSF) ->
|
||||||
( getAmmoLinks itm
|
( getAmmoLinks itm
|
||||||
@@ -101,6 +104,15 @@ getAutoSpringLinks itm = case itm ^? itUse . heldTriggerType of
|
|||||||
Just HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
Just HammerTrigger -> [(MakeAutoSF, MakeAutoLink)]
|
||||||
_ -> []
|
_ -> []
|
||||||
|
|
||||||
|
extraWeaponLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||||
|
extraWeaponLinks itm = case itm ^. itType of
|
||||||
|
HELD GLAUNCHER -> launcherlinks
|
||||||
|
HELD RLAUNCHER -> launcherlinks
|
||||||
|
HELD RLAUNCHERX{} -> launcherlinks
|
||||||
|
_ -> []
|
||||||
|
where
|
||||||
|
launcherlinks = [(ProjectileStabiliserSF,ProjectileStabiliserLink)]
|
||||||
|
|
||||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||||
getAmmoLinks itm =
|
getAmmoLinks itm =
|
||||||
map
|
map
|
||||||
@@ -139,7 +151,10 @@ itemToFunction itm = case itm ^. itType of
|
|||||||
structureToPotentialFunction ::
|
structureToPotentialFunction ::
|
||||||
LabelDoubleTree ItemLink ComposedItem ->
|
LabelDoubleTree ItemLink ComposedItem ->
|
||||||
S.Set ItemStructuralFunction
|
S.Set ItemStructuralFunction
|
||||||
structureToPotentialFunction = S.singleton . (^. ldtValue . _2)
|
structureToPotentialFunction ldt = case ldt ^. ldtValue . _1 . itType of
|
||||||
|
ATTACH GIMBAL -> S.singleton ProjectileStabiliserSF
|
||||||
|
ATTACH GYROSCOPE -> S.singleton ProjectileStabiliserSF
|
||||||
|
_ -> S.singleton (ldt ^. ldtValue . _2)
|
||||||
|
|
||||||
baseCI :: Item -> ComposedItem
|
baseCI :: Item -> ComposedItem
|
||||||
baseCI itm = (itm, itemToFunction itm, itemBaseConnections itm)
|
baseCI itm = (itm, itemToFunction itm, itemBaseConnections itm)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ itemInvColor ci = case ci ^. _2 of
|
|||||||
AmmoPayloadSF{} -> violet
|
AmmoPayloadSF{} -> violet
|
||||||
AmmoEffectSF{} -> aquamarine
|
AmmoEffectSF{} -> aquamarine
|
||||||
FunctionChangeSF -> yellow
|
FunctionChangeSF -> yellow
|
||||||
|
ProjectileStabiliserSF -> white
|
||||||
|
|
||||||
--ammoTypeColor :: AmmoType -> Color
|
--ammoTypeColor :: AmmoType -> Color
|
||||||
--ammoTypeColor = \case
|
--ammoTypeColor = \case
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
module Dodge.Item.Scope (
|
module Dodge.Item.Scope (
|
||||||
|
gimbal,
|
||||||
|
gyroscope,
|
||||||
stickyMod,
|
stickyMod,
|
||||||
shellModule,
|
shellModule,
|
||||||
zoomScope,
|
zoomScope,
|
||||||
@@ -75,6 +77,12 @@ remoteDetonator = makeAttach REMOTEDETONATOR
|
|||||||
joystick :: Item
|
joystick :: Item
|
||||||
joystick = makeAttach JOYSTICK
|
joystick = makeAttach JOYSTICK
|
||||||
-- & itUse . uaParams .~ APLinkProjectile Nothing
|
-- & itUse . uaParams .~ APLinkProjectile Nothing
|
||||||
|
--
|
||||||
|
gimbal :: Item
|
||||||
|
gimbal = makeAttach GIMBAL
|
||||||
|
|
||||||
|
gyroscope :: Item
|
||||||
|
gyroscope = makeAttach GYROSCOPE
|
||||||
|
|
||||||
smokeReducer :: Item
|
smokeReducer :: Item
|
||||||
smokeReducer = makeAttach SMOKEREDUCER
|
smokeReducer = makeAttach SMOKEREDUCER
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
module Dodge.Projectile.Create (
|
module Dodge.Projectile.Create (
|
||||||
createShell,
|
createShell,
|
||||||
|
PJStabiliser (..),
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import NewInt
|
import NewInt
|
||||||
@@ -12,12 +13,18 @@ import Geometry
|
|||||||
import qualified IntMapHelp as IM
|
import qualified IntMapHelp as IM
|
||||||
import LensHelp
|
import LensHelp
|
||||||
|
|
||||||
|
data PJStabiliser
|
||||||
|
= StabOrthReduce
|
||||||
|
| StabSpinIncrease
|
||||||
|
|
||||||
|
|
||||||
-- assumes the mscreen is in your inventory
|
-- assumes the mscreen is in your inventory
|
||||||
createShell ::Maybe (NewInt ItmInt)
|
createShell ::Maybe (NewInt ItmInt)
|
||||||
-> Maybe (NewInt ItmInt)
|
-> Maybe (NewInt ItmInt)
|
||||||
|
-> Maybe PJStabiliser
|
||||||
-> ProjectileType
|
-> ProjectileType
|
||||||
-> Payload -> Muzzle -> Creature -> World -> World
|
-> Payload -> Muzzle -> Creature -> World -> World
|
||||||
createShell mdetonator mscreen pjtype payload muz cr w = w
|
createShell mdetonator mscreen stab pjtype payload muz cr w = w
|
||||||
& updatescreen
|
& updatescreen
|
||||||
& updatedetonator
|
& updatedetonator
|
||||||
& cWorld . lWorld . projectiles . at i
|
& cWorld . lWorld . projectiles . at i
|
||||||
@@ -25,23 +32,28 @@ createShell mdetonator mscreen pjtype payload muz cr w = w
|
|||||||
{ _pjPos = pos
|
{ _pjPos = pos
|
||||||
, _pjZ = 20
|
, _pjZ = 20
|
||||||
, _pjZVel = 5
|
, _pjZVel = 5
|
||||||
, _pjVel = rotateV dir (V2 speed 0) + cr ^. crPos - cr ^. crOldPos
|
, _pjVel = rotateV dir (V2 speed 0) + crvelcomponent
|
||||||
, _pjID = i
|
, _pjID = i
|
||||||
, _pjDir = dir
|
, _pjDir = dir
|
||||||
, _pjSpin = 0
|
, _pjSpin = 0
|
||||||
, _pjPayload = payload
|
, _pjPayload = payload
|
||||||
, _pjTimer = lifespan
|
, _pjTimer = lifespan
|
||||||
, _pjUpdates =
|
, _pjUpdates =
|
||||||
[-- TimePU
|
anyspin <>
|
||||||
StartSpinPU (lifespan - 15) (_crID cr) spinamount
|
[ RemoteDirectionPU (lifespan - thrustdelay) 0
|
||||||
, RemoteDirectionPU (lifespan - thrustdelay) 0
|
|
||||||
-- , ReduceSpinPU (1 - spindrag * 2 / 200)
|
|
||||||
] <> thrustorgrav
|
] <> thrustorgrav
|
||||||
, _pjType = pjtype
|
, _pjType = pjtype
|
||||||
, _pjDetonatorID = mdetonator
|
, _pjDetonatorID = mdetonator
|
||||||
, _pjScreenID = mscreen
|
, _pjScreenID = mscreen
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
|
crvelcomponent = case stab of
|
||||||
|
Just StabOrthReduce -> projV (cr ^. crPos - cr ^. crOldPos) (unitVectorAtAngle dir)
|
||||||
|
_ -> cr ^. crPos - cr ^. crOldPos
|
||||||
|
anyspin = case stab of
|
||||||
|
Just StabOrthReduce -> []
|
||||||
|
Just StabSpinIncrease -> [StartSpinPU (lifespan - 15) (_crID cr) 4]
|
||||||
|
_ -> [StartSpinPU (lifespan - 15) (_crID cr) 2]
|
||||||
speed = case pjtype of
|
speed = case pjtype of
|
||||||
Grenade {} -> 4
|
Grenade {} -> 4
|
||||||
Rocket{} -> 1
|
Rocket{} -> 1
|
||||||
@@ -51,8 +63,6 @@ createShell mdetonator mscreen pjtype payload muz cr w = w
|
|||||||
Grenade {}-> [ApplyGravityPU]
|
Grenade {}-> [ApplyGravityPU]
|
||||||
Rocket{} -> [ThrustPU (lifespan - thrustdelay) 0]
|
Rocket{} -> [ThrustPU (lifespan - thrustdelay) 0]
|
||||||
RetiredProjectile -> []
|
RetiredProjectile -> []
|
||||||
-- spindrag = 1
|
|
||||||
spinamount = 2
|
|
||||||
thrustdelay = 20
|
thrustdelay = 20
|
||||||
updatedetonator = fromMaybe id $ do
|
updatedetonator = fromMaybe id $ do
|
||||||
screenid <- mdetonator
|
screenid <- mdetonator
|
||||||
|
|||||||
Reference in New Issue
Block a user