Move shells to external magazines
This commit is contained in:
@@ -4,15 +4,19 @@ import Dodge.Data.World
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
--import Data.Maybe
|
||||
|
||||
createProjectile :: ProjectileCreate -> Item -> Creature -> World -> World
|
||||
createProjectile pt = case pt of
|
||||
CreateShell -> fireShell
|
||||
CreateTrackingShell -> fireTrackingShell
|
||||
createProjectile :: AmmoParams -> Item -> Creature -> World -> World
|
||||
createProjectile apm itm cr = case pt of
|
||||
CreateShell -> fireShell apm itm cr
|
||||
CreateTrackingShell -> fireTrackingShell apm itm cr
|
||||
where
|
||||
pt = _ampPjCreation apm
|
||||
|
||||
fireShell :: Item -> Creature -> World -> World
|
||||
fireShell it cr =
|
||||
fireShell :: AmmoParams -> Item -> Creature -> World -> World
|
||||
fireShell ap it cr =
|
||||
makeShell
|
||||
ap
|
||||
it
|
||||
cr
|
||||
[ PJShellCollisionCheck
|
||||
@@ -27,8 +31,8 @@ fireShell it cr =
|
||||
spinamount = _shellSpinAmount params
|
||||
thrustdelay = _shellThrustDelay params
|
||||
|
||||
makeShell :: Item -> Creature -> [ProjectileUpdate] -> World -> World
|
||||
makeShell it cr theupdate w =
|
||||
makeShell :: AmmoParams -> Item -> Creature -> [ProjectileUpdate] -> World -> World
|
||||
makeShell ap it cr theupdate w =
|
||||
w & cWorld . lWorld . projectiles . at i
|
||||
?~ Shell
|
||||
{ _prjPos = pos
|
||||
@@ -40,7 +44,7 @@ makeShell it cr theupdate w =
|
||||
, _prjAcc = rotateV dir (V2 3 0)
|
||||
, _prjDir = dir
|
||||
, _prjSpin = 0
|
||||
, _prjPayload = _amPayload $ _laAmmoType am
|
||||
, _prjPayload = _ampPayload ap
|
||||
, _prjTimer = 350
|
||||
, _prjUpdates = theupdate
|
||||
, _prjMITID = Just $ _itID it
|
||||
@@ -49,11 +53,12 @@ makeShell it cr theupdate w =
|
||||
i = IM.newKey $ w ^. cWorld . lWorld . props-- _props (_cWorld w)
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ rotateV dir (V2 (_crRad cr + 1) 0)
|
||||
am = _heldConsumption $ _itUse it
|
||||
--am = _heldConsumption $ _itUse it
|
||||
|
||||
fireTrackingShell :: Item -> Creature -> World -> World
|
||||
fireTrackingShell it cr =
|
||||
fireTrackingShell :: AmmoParams -> Item -> Creature -> World -> World
|
||||
fireTrackingShell ap it cr =
|
||||
makeShell
|
||||
ap
|
||||
it
|
||||
cr
|
||||
[ PJRemoteShellCollisionCheck
|
||||
|
||||
Reference in New Issue
Block a user