Separate out ammo data
This commit is contained in:
@@ -1,25 +1,55 @@
|
||||
module Dodge.Projectile.Create where
|
||||
import Dodge.Data
|
||||
--import Dodge.Item.Weapon.Shell
|
||||
--import Dodge.Base.Collide
|
||||
--import Dodge.Base
|
||||
--import Dodge.Payload
|
||||
--import Dodge.SoundLogic
|
||||
--import Dodge.Movement.Turn
|
||||
--import Dodge.Item.Location
|
||||
import Dodge.Item.Location
|
||||
--import Dodge.EnergyBall
|
||||
--import Dodge.WorldEvent.Cloud
|
||||
--import LensHelp
|
||||
--import qualified IntMapHelp as IM
|
||||
--import Geometry
|
||||
import LensHelp
|
||||
import qualified IntMapHelp as IM
|
||||
import Geometry
|
||||
--import RandomHelp
|
||||
--
|
||||
|
||||
--import Data.Maybe
|
||||
|
||||
createProjectile :: ProjectileCreate -> Item -> Creature -> World -> World
|
||||
createProjectile pt = case pt of
|
||||
CreateShell -> undefined
|
||||
--CreateRemoteShell -> undefined
|
||||
CreateShell -> fireShell
|
||||
CreateTrackingShell -> fireTrackingShell
|
||||
|
||||
fireShell :: Item -> Creature -> World -> World
|
||||
fireShell it cr = makeShell it cr
|
||||
[ PJSpin 335 (_crID cr) spinamount
|
||||
, PJThrust (350 - thrustdelay) 0
|
||||
, PJReduceSpin (1-fromIntegral spindrag*2 / 200)
|
||||
]
|
||||
where
|
||||
params = _itParams it
|
||||
spindrag = _shellSpinDrag params
|
||||
spinamount = _shellSpinAmount params
|
||||
thrustdelay = _shellThrustDelay params
|
||||
makeShell :: Item -> Creature -> [ProjectileUpdate] -> World -> World
|
||||
makeShell it cr theupdate w = w & projectiles %~ IM.insert i Shell
|
||||
{ _prjPos = pos
|
||||
, _prjZ = 20
|
||||
, _prjStartPos = pos
|
||||
, _prjVel = rotateV dir (V2 1 0)
|
||||
, _prjDraw = DrawShell
|
||||
, _prjID = i
|
||||
, _prjAcc = rotateV dir (V2 3 0)
|
||||
, _prjDir = dir
|
||||
, _prjSpin = 0
|
||||
, _prjPayload = _amPayload $ _laAmmoType am
|
||||
, _prjTimer = 350
|
||||
, _prjUpdates = theupdate
|
||||
, _prjMITID = _itID it
|
||||
}
|
||||
where
|
||||
i = IM.newKey $ _props w
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) 0)
|
||||
am = _itConsumption it
|
||||
|
||||
--fireShell :: Item -> Creature -> World -> World
|
||||
--fireShell it cr = makeShell it cr $ \pj -> pjEffAtTime 35 (trySpinByCID (_crID cr) spinamount) pj
|
||||
@@ -159,3 +189,17 @@ createProjectile pt = case pt of
|
||||
-- | otherwise = id
|
||||
-- where
|
||||
-- t = _prjTimer pj
|
||||
fireTrackingShell :: Item -> Creature -> World -> World
|
||||
fireTrackingShell it cr w = addTrackRocket w'
|
||||
where
|
||||
(w',itid) = getHeldItemLoc cr w
|
||||
addTrackRocket = makeShell it cr
|
||||
[ PJSpin 335 (_crID cr) spinamount
|
||||
, PJTrack (350 - thrustdelay) 0 itid
|
||||
, PJThrust (350 - thrustdelay) 0
|
||||
, PJReduceSpin (1-fromIntegral spindrag*2 / 200)
|
||||
]
|
||||
spinamount = _shellSpinAmount params
|
||||
thrustdelay = _shellThrustDelay params
|
||||
spindrag = _shellSpinDrag params
|
||||
params = _itParams it
|
||||
|
||||
Reference in New Issue
Block a user