Add arbitrary remote launcher payload
This commit is contained in:
@@ -156,17 +156,16 @@ doThrust pj w = w
|
|||||||
r1 = randInCirc 10 & evalState $ _randGen w
|
r1 = randInCirc 10 & evalState $ _randGen w
|
||||||
|
|
||||||
fireLauncher :: Item -> Creature -> World -> World
|
fireLauncher :: Item -> Creature -> World -> World
|
||||||
fireLauncher it cr w = addShell w
|
fireLauncher it cr = makeShell it cr $ \pj -> pjEffAtTime 35 (trySpinByCID (_crID cr) spinamount) pj
|
||||||
|
. pjThrust thrustdelay pj
|
||||||
|
. reduceSpinBy (1-fromIntegral spindrag*2 / 200) pj
|
||||||
|
. decTimMvVel pj
|
||||||
|
. moveShell pj
|
||||||
where
|
where
|
||||||
params = _itParams it
|
params = _itParams it
|
||||||
spindrag = _shellSpinDrag params
|
spindrag = _shellSpinDrag params
|
||||||
spinamount = _shellSpinAmount params
|
spinamount = _shellSpinAmount params
|
||||||
thrustdelay = _shellThrustDelay params
|
thrustdelay = _shellThrustDelay params
|
||||||
addShell = makeShell it cr $ \pj -> pjEffAtTime 35 (trySpinByCID (_crID cr) spinamount) pj
|
|
||||||
. pjThrust thrustdelay pj
|
|
||||||
. reduceSpinBy (1-fromIntegral spindrag*2 / 200) pj
|
|
||||||
. decTimMvVel pj
|
|
||||||
. moveShell pj
|
|
||||||
|
|
||||||
moveShell :: Prop -- ^ Projectile id
|
moveShell :: Prop -- ^ Projectile id
|
||||||
-> World
|
-> World
|
||||||
@@ -260,9 +259,12 @@ trackingLauncher = launcher
|
|||||||
& itType .~ TRACKINGLAUNCHER
|
& itType .~ TRACKINGLAUNCHER
|
||||||
& itUse . rUse .~ fireTrackingLauncher
|
& itUse . rUse .~ fireTrackingLauncher
|
||||||
|
|
||||||
|
remoteLauncherName :: String
|
||||||
|
remoteLauncherName = "ROCKO-REMOTE"
|
||||||
|
|
||||||
remoteLauncher :: Item
|
remoteLauncher :: Item
|
||||||
remoteLauncher = launcher
|
remoteLauncher = launcher
|
||||||
& itName .~ "ROCKO-REMOTE"
|
& itName .~ remoteLauncherName
|
||||||
& itType .~ REMOTELAUNCHER
|
& itType .~ REMOTELAUNCHER
|
||||||
& itUse . rUse .~ fireRemoteLauncher
|
& itUse . rUse .~ fireRemoteLauncher
|
||||||
& itScope .~ RemoteScope (V2 0 0) 1 True
|
& itScope .~ RemoteScope (V2 0 0) 1 True
|
||||||
@@ -273,7 +275,7 @@ fireRemoteLauncher :: Item -> Creature -> World -> World
|
|||||||
fireRemoteLauncher it cr w = setLocation
|
fireRemoteLauncher it cr w = setLocation
|
||||||
$ set (creatures . ix cid . crInv . ix j . itUse . rUse)
|
$ set (creatures . ix cid . crInv . ix j . itUse . rUse)
|
||||||
(\_ _ -> explodeRemoteRocket itid i)
|
(\_ _ -> explodeRemoteRocket itid i)
|
||||||
$ set (creatures . ix cid . crInv . ix j . itName) "REMOTEROCKET"
|
$ set (creatures . ix cid . crInv . ix j . itName) remoteLauncherName
|
||||||
$ addRemRocket w
|
$ addRemRocket w
|
||||||
where
|
where
|
||||||
i = IM.newKey $ _props w
|
i = IM.newKey $ _props w
|
||||||
@@ -337,14 +339,15 @@ explodeRemoteRocket
|
|||||||
-> Int -- ^ Projectile id
|
-> Int -- ^ Projectile id
|
||||||
-> World
|
-> World
|
||||||
-> World
|
-> World
|
||||||
explodeRemoteRocket itid pjid w
|
explodeRemoteRocket itid pjid w = w
|
||||||
= set (props . ix pjid . pjUpdate) (\_ -> retireRemoteProj fireRemoteLauncher itid 30 pjid)
|
& props . ix pjid . pjUpdate .~ (\_ -> retireRemoteProj fireRemoteLauncher itid 30 pjid)
|
||||||
$ set (props . ix pjid . prDraw) (const mempty)
|
& props . ix pjid . prDraw .~ const mempty
|
||||||
$ set (itPoint . itUse . rUse) (\_ _ -> id)
|
& itPoint . itUse . rUse .~ (\_ _ -> id)
|
||||||
$ set (itPoint . itName) "REMOTELAUNCHER"
|
& itPoint . itName .~ "REMOTELAUNCHER"
|
||||||
$ makeExplosionAt (_pjPos (_props w IM.! pjid)) w
|
& _pjPayload thepj (_pjPos thepj)
|
||||||
where
|
where
|
||||||
itPoint = pointToItem $ _itemPositions w IM.! itid
|
itPoint = pointToItem $ _itemPositions w IM.! itid
|
||||||
|
thepj = _props w IM.! pjid
|
||||||
|
|
||||||
fireTrackingLauncher :: Item -> Creature -> World -> World
|
fireTrackingLauncher :: Item -> Creature -> World -> World
|
||||||
fireTrackingLauncher it cr w = setLocation
|
fireTrackingLauncher it cr w = setLocation
|
||||||
|
|||||||
Reference in New Issue
Block a user