Cleanup module pathing
This commit is contained in:
@@ -1,42 +1,51 @@
|
||||
module Dodge.Projectile.Create where
|
||||
|
||||
import Dodge.Data
|
||||
import Dodge.Item.Location
|
||||
import LensHelp
|
||||
import qualified IntMapHelp as IM
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
createProjectile :: ProjectileCreate -> Item -> Creature -> World -> World
|
||||
createProjectile :: ProjectileCreate -> Item -> Creature -> World -> World
|
||||
createProjectile pt = case pt of
|
||||
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
|
||||
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 & cWorld . 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
|
||||
}
|
||||
makeShell it cr theupdate w =
|
||||
w & cWorld . 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 (_cWorld w)
|
||||
dir = _crDir cr
|
||||
@@ -44,19 +53,19 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
am = _heldConsumption $ _itUse it
|
||||
|
||||
--fireShell :: Item -> Creature -> World -> World
|
||||
--fireShell 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
|
||||
--fireShell 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
|
||||
-- spindrag = _shellSpinDrag params
|
||||
-- spinamount = _shellSpinAmount params
|
||||
-- thrustdelay = _shellThrustDelay params
|
||||
--
|
||||
--makeShell :: Item -> Creature -> (Proj -> World -> World) -> World -> World
|
||||
--makeShell it cr theupdate w = w & projectiles %~ IM.insert i Shell
|
||||
--makeShell it cr theupdate w = w & projectiles %~ IM.insert i Shell
|
||||
-- { _prjPos = pos
|
||||
-- , _prjZ = 20
|
||||
-- , _prjStartPos = pos
|
||||
@@ -77,19 +86,19 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
-- am = _itConsumption it
|
||||
--
|
||||
--moveShell :: Proj
|
||||
-- -> World
|
||||
-- -> World
|
||||
--moveShell pj w
|
||||
-- -> World
|
||||
--moveShell pj w
|
||||
-- | time > 40 = if circOnSomeWall oldPos 4 w
|
||||
-- then doExplode
|
||||
-- else w
|
||||
-- | anythingHitCirc 2 oldPos newPos w = doExplode
|
||||
-- | time > -300 = w
|
||||
-- | otherwise = doExplode
|
||||
-- where
|
||||
-- where
|
||||
-- time = _prjTimer pj
|
||||
-- doExplode = w
|
||||
-- & usePayload (_prjPayload pj) oldPos
|
||||
-- & usePayload (_prjPayload pj) oldPos
|
||||
-- & stopSoundFrom (ShellSound i)
|
||||
-- & props %~ IM.delete i
|
||||
-- i = _prjID pj
|
||||
@@ -101,13 +110,13 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
--usePjCreation it = createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it
|
||||
--
|
||||
--usePjCreationX :: Int -> Item -> Creature -> World -> World
|
||||
--usePjCreationX i it cr = foldr f
|
||||
--usePjCreationX i it cr = foldr f
|
||||
-- (createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it cr)
|
||||
-- [1..i-1]
|
||||
-- where
|
||||
-- f n = (. createProjectile (_amPjCreation (_laAmmoType (_itConsumption it))) it (cr & crDir +~ (2*pi*fromIntegral n / fromIntegral i)))
|
||||
--
|
||||
--pjEffAtTime
|
||||
--pjEffAtTime
|
||||
-- :: Int
|
||||
-- -> (Proj -> World -> World)
|
||||
-- -> Proj
|
||||
@@ -121,7 +130,7 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
-- :: Int -- ^ creature id
|
||||
-- -> Int -- ^ Spin amount
|
||||
-- -> Proj
|
||||
-- -> World
|
||||
-- -> World
|
||||
-- -> World
|
||||
--trySpinByCID cid i pj w = w & projectiles . ix pjid . prjSpin .~ newSpin
|
||||
-- where
|
||||
@@ -146,7 +155,7 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
-- st = et - 100
|
||||
-- rotateToTarget _ = fromMaybe id $ do
|
||||
-- tpos <- w ^? itPoint . itTargeting . tgPos . _Just
|
||||
-- return $ projectiles . ix (_prjID pj) . prjSpin .~ turnToAmount 0.15 (_prjPos pj) tpos
|
||||
-- return $ projectiles . ix (_prjID pj) . prjSpin .~ turnToAmount 0.15 (_prjPos pj) tpos
|
||||
-- (argV $ _prjAcc pj)
|
||||
-- itPoint = pointToItem $ _itemPositions w IM.! itid
|
||||
--
|
||||
@@ -174,7 +183,7 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
-- :: (Int,Int)
|
||||
-- -> (Proj -> World -> World)
|
||||
-- -> Proj
|
||||
-- -> World
|
||||
-- -> World
|
||||
-- -> World
|
||||
--pjEffTimeRange (st,et) f pj
|
||||
-- | t <= et && t >= st = f pj
|
||||
@@ -184,13 +193,16 @@ makeShell it cr theupdate w = w & cWorld . projectiles %~ IM.insert i Shell
|
||||
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)
|
||||
]
|
||||
(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
|
||||
|
||||
Reference in New Issue
Block a user