Tweak rockets, smoke
This commit is contained in:
@@ -18,7 +18,7 @@ import Dodge.Data.Bullet
|
|||||||
import Dodge.Data.Payload
|
import Dodge.Data.Payload
|
||||||
|
|
||||||
data ProjectileUpdate
|
data ProjectileUpdate
|
||||||
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int, _pjuSmokeless :: Bool}
|
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||||
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
|
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
|
||||||
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
|
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int}
|
||||||
| ReduceSpinPU {_pjuReduceSpin :: Float}
|
| ReduceSpinPU {_pjuReduceSpin :: Float}
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ import Data.Aeson.TH
|
|||||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
|
|
||||||
data ProjectileType
|
|
||||||
= Grenade
|
|
||||||
| Rocket {_rkHoming :: RocketHoming}
|
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
||||||
|
|
||||||
data Projectile
|
data Projectile
|
||||||
= Shell
|
= Shell
|
||||||
{ _prjPos :: Point2
|
{ _prjPos :: Point2
|
||||||
@@ -34,16 +29,29 @@ data Projectile
|
|||||||
}
|
}
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data ProjectileType
|
||||||
|
= Grenade
|
||||||
|
| Rocket
|
||||||
|
{_rkHoming :: RocketHoming
|
||||||
|
,_rkSmoke :: Maybe RocketSmoke
|
||||||
|
}
|
||||||
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data RocketHoming
|
data RocketHoming
|
||||||
= NoHoming
|
= NoHoming
|
||||||
| HomeUsingRemoteScreen {_phRemoteID :: NewInt ItmInt}
|
| HomeUsingRemoteScreen {_phRemoteID :: NewInt ItmInt}
|
||||||
| HomeUsingTargeting {_phTargetingID :: NewInt ItmInt}
|
| HomeUsingTargeting {_phTargetingID :: NewInt ItmInt}
|
||||||
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
data RocketSmoke
|
||||||
|
= ReducedRocketSmoke
|
||||||
|
deriving (Show, Eq, Ord, Read) --Generic, Flat)
|
||||||
|
|
||||||
|
|
||||||
makeLenses ''Projectile
|
makeLenses ''Projectile
|
||||||
makeLenses ''ProjectileType
|
makeLenses ''ProjectileType
|
||||||
makeLenses ''RocketHoming
|
makeLenses ''RocketHoming
|
||||||
deriveJSON defaultOptions ''RocketHoming
|
deriveJSON defaultOptions ''RocketHoming
|
||||||
|
deriveJSON defaultOptions ''RocketSmoke
|
||||||
deriveJSON defaultOptions ''ProjectileType
|
deriveJSON defaultOptions ''ProjectileType
|
||||||
deriveJSON defaultOptions ''Projectile
|
deriveJSON defaultOptions ''Projectile
|
||||||
|
|||||||
@@ -47,7 +47,9 @@ drawFlamelet pt =
|
|||||||
(fromIntegral (max 0 (time -2)))
|
(fromIntegral (max 0 (time -2)))
|
||||||
(10 - fromIntegral time)
|
(10 - fromIntegral time)
|
||||||
(V4 2 0 0 1)
|
(V4 2 0 0 1)
|
||||||
(V4 2 0 0 0)
|
(V4 2 0 0 1)
|
||||||
|
--(V4 2 0 0 1)
|
||||||
|
--(V4 2 0 0 0)
|
||||||
)
|
)
|
||||||
. rotate (negate (rot - 0.1 * fromIntegral time))
|
. rotate (negate (rot - 0.1 * fromIntegral time))
|
||||||
. scale s1 s1
|
. scale s1 s1
|
||||||
@@ -60,8 +62,10 @@ drawFlamelet pt =
|
|||||||
( mixColors
|
( mixColors
|
||||||
(fromIntegral (max 0 (time -2)))
|
(fromIntegral (max 0 (time -2)))
|
||||||
(10 - fromIntegral time)
|
(10 - fromIntegral time)
|
||||||
(V4 2 1 0 0.5)
|
(V4 2 1 0 1)
|
||||||
(V4 0 0 0 0)
|
(V4 0 0 0 1)
|
||||||
|
--(V4 2 1 0 0.5)
|
||||||
|
--(V4 0 0 0 0)
|
||||||
)
|
)
|
||||||
. rotate (negate (rot + 0.2 * fromIntegral time))
|
. rotate (negate (rot + 0.2 * fromIntegral time))
|
||||||
. scale s2 s2
|
. scale s2 s2
|
||||||
|
|||||||
+12
-3
@@ -614,7 +614,15 @@ createProjectileR ::
|
|||||||
World ->
|
World ->
|
||||||
World
|
World
|
||||||
createProjectileR magtree muz itmtree cr =
|
createProjectileR magtree muz itmtree cr =
|
||||||
createProjectile (Rocket $ determineProjectileTracking magtree itmtree) magtree muz itmtree cr
|
createProjectile
|
||||||
|
(Rocket
|
||||||
|
(determineProjectileTracking magtree itmtree)
|
||||||
|
smoke
|
||||||
|
) magtree muz itmtree cr
|
||||||
|
where
|
||||||
|
smoke
|
||||||
|
| isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft) = Just ReducedRocketSmoke
|
||||||
|
| otherwise = Nothing
|
||||||
|
|
||||||
createProjectile ::
|
createProjectile ::
|
||||||
ProjectileType ->
|
ProjectileType ->
|
||||||
@@ -632,11 +640,12 @@ createProjectile pjtype magtree muz itmtree cr = fromMaybe failsound $ do
|
|||||||
lookup RemoteDetonatorLink (magtree ^. ldtLeft)
|
lookup RemoteDetonatorLink (magtree ^. ldtLeft)
|
||||||
rscreen = fmap (^. ldtValue . itID) $
|
rscreen = fmap (^. ldtValue . itID) $
|
||||||
lookup RemoteScreenLink (magtree ^. ldtLeft)
|
lookup RemoteScreenLink (magtree ^. ldtLeft)
|
||||||
issmokeless = isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft)
|
-- issmokeless = isJust $ lookup SmokeReducerLink (magtree ^. ldtLeft)
|
||||||
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 homing rdetonate rscreen issmokeless pjtype aparams muz cr
|
--createShell homing rdetonate rscreen issmokeless pjtype aparams muz cr
|
||||||
|
createShell homing rdetonate rscreen 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
|
||||||
|
|||||||
@@ -16,10 +16,11 @@ import LensHelp
|
|||||||
createShell :: RocketHoming
|
createShell :: RocketHoming
|
||||||
-> Maybe (NewInt ItmInt)
|
-> Maybe (NewInt ItmInt)
|
||||||
-> Maybe (NewInt ItmInt)
|
-> Maybe (NewInt ItmInt)
|
||||||
-> Bool
|
-- -> Bool
|
||||||
-> ProjectileType
|
-> ProjectileType
|
||||||
-> Payload -> Muzzle -> Creature -> World -> World
|
-> Payload -> Muzzle -> Creature -> World -> World
|
||||||
createShell homing mdetonator mscreen smokestatus pjtype payload muz cr w = w
|
--createShell homing mdetonator mscreen smokestatus pjtype payload muz cr w = w
|
||||||
|
createShell homing mdetonator mscreen pjtype payload muz cr w = w
|
||||||
& updatescreen
|
& updatescreen
|
||||||
& updatedetonator
|
& updatedetonator
|
||||||
& cWorld . lWorld . projectiles . at i
|
& cWorld . lWorld . projectiles . at i
|
||||||
@@ -52,7 +53,7 @@ createShell homing mdetonator mscreen smokestatus pjtype payload muz cr w = w
|
|||||||
Rocket{} -> 350
|
Rocket{} -> 350
|
||||||
thrustorgrav = case pjtype of
|
thrustorgrav = case pjtype of
|
||||||
Grenade -> [ApplyGravityPU]
|
Grenade -> [ApplyGravityPU]
|
||||||
Rocket{} -> [ThrustPU (lifespan - thrustdelay) 0 smokestatus]
|
Rocket{} -> [ThrustPU (lifespan - thrustdelay) 0]
|
||||||
spindrag = 1
|
spindrag = 1
|
||||||
spinamount = 2
|
spinamount = 2
|
||||||
thrustdelay = 20
|
thrustdelay = 20
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ upProjectile pu pj = case pu of
|
|||||||
mscreenid
|
mscreenid
|
||||||
pj
|
pj
|
||||||
TimePU -> decTimMvVel pj
|
TimePU -> decTimMvVel pj
|
||||||
ThrustPU st et smoke
|
ThrustPU st et
|
||||||
| act st et -> doThrust pj smoke
|
| act st et -> doThrust pj (pj ^? prjType . rkSmoke . _Just)
|
||||||
| otherwise -> id
|
| otherwise -> id
|
||||||
StartSpinPU t cid spinamount
|
StartSpinPU t cid spinamount
|
||||||
| time == t -> trySpinByCID cid spinamount pj
|
| time == t -> trySpinByCID cid spinamount pj
|
||||||
@@ -112,7 +112,7 @@ destroyProjectile mitid pjid w =
|
|||||||
guard $ itm == pjid
|
guard $ itm == pjid
|
||||||
return $ pointerToItemLocation loc . itUse . uaParams . apLinkedProjectile .~ Nothing
|
return $ pointerToItemLocation loc . itUse . uaParams . apLinkedProjectile .~ Nothing
|
||||||
|
|
||||||
doThrust :: Projectile -> Bool -> World -> World
|
doThrust :: Projectile -> Maybe RocketSmoke -> World -> World
|
||||||
doThrust pj smoke w =
|
doThrust pj smoke w =
|
||||||
w
|
w
|
||||||
& randGen .~ g
|
& randGen .~ g
|
||||||
@@ -127,7 +127,7 @@ doThrust pj smoke w =
|
|||||||
where
|
where
|
||||||
lifetime = fst . randomR lt $ _randGen w
|
lifetime = fst . randomR lt $ _randGen w
|
||||||
lt
|
lt
|
||||||
| smoke = (50, 200)
|
| smoke == Just ReducedRocketSmoke = (50, 200)
|
||||||
| otherwise = (300, 500)
|
| otherwise = (300, 500)
|
||||||
trailfadetime = fst . randomR (100, 300) $ _randGen w
|
trailfadetime = fst . randomR (100, 300) $ _randGen w
|
||||||
accel = rotateV (pj ^. prjDir) (V2 3 0)
|
accel = rotateV (pj ^. prjDir) (V2 3 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user