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