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