Cleanup, remove records, stop unecessary Aeson compile
This commit is contained in:
+16
-6
@@ -24,6 +24,14 @@ updateBullet w bu
|
||||
-- have to be slightly carefull not to accelerate bullets using magnets
|
||||
| otherwise = second (Just . updateBulVel) . hitEffFromBul w $ applyMagnetsToBul bu w
|
||||
|
||||
buDamages :: Bullet -> [Damage]
|
||||
buDamages bu = case _buPayload bu of
|
||||
BulBall {} -> []
|
||||
BulPlain x -> [Damage PIERCING x 0 0 0 $ PushBackDamage 2]
|
||||
BulFlak -> []
|
||||
BulFrag -> []
|
||||
BulGas -> []
|
||||
|
||||
-- do we want this to drain energy from the deflection source?
|
||||
applyMagnetsToBul :: Bullet -> World -> Bullet
|
||||
applyMagnetsToBul bu = foldl' doMagnetBuBu bu . _oldMagnets . _lWorld . _cWorld
|
||||
@@ -110,7 +118,7 @@ bounceDir _ = Nothing
|
||||
|
||||
useBulletPayload :: Bullet -> Point2 -> World -> World
|
||||
useBulletPayload bu = case _buPayload bu of
|
||||
BulSpark -> const id
|
||||
BulPlain _ -> const id
|
||||
BulFlak -> makeFlak bu
|
||||
BulFrag -> makeFragBullets
|
||||
BulGas -> (`makeGasCloud` V2 0 0)
|
||||
@@ -126,12 +134,14 @@ makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
|
||||
as = randomRs (0, 2 * pi) $ _randGen w
|
||||
ss = randomRs (5, 15) $ _randGen w
|
||||
f a s =
|
||||
defaultBullet & buVel .~ s *.* unitVectorAtAngle a
|
||||
defaultBullet
|
||||
& buPayload .~ BulPlain 5
|
||||
& buVel .~ s *.* unitVectorAtAngle a
|
||||
& buDrag .~ 0.8
|
||||
& buPos .~ p
|
||||
& buOldPos .~ p
|
||||
& buWidth .~ 1
|
||||
& buDamages .~ [Damage PIERCING 5 0 0 0 $ PushBackDamage 2]
|
||||
-- & buDamages .~ [Damage PIERCING 5 0 0 0 $ PushBackDamage 2]
|
||||
|
||||
makeFlak :: Bullet -> Point2 -> World -> World
|
||||
makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
|
||||
@@ -139,9 +149,9 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
|
||||
s = min 10 (0.5 * magV (_buVel bu))
|
||||
xs = take 5 $ randomRs (- s, s) $ _randGen w
|
||||
f x = bu & buVel %~ g x
|
||||
& buPayload .~ BulSpark
|
||||
& buPayload .~ BulPlain 25
|
||||
& buWidth .~ 0.5
|
||||
& buDamages .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2]
|
||||
-- & buDamages .~ [Damage PIERCING 25 0 0 0 $ PushBackDamage 2]
|
||||
g x v = v +.+ x *.* normalizeV (vNormal v)
|
||||
|
||||
hitEffFromBul :: World -> Bullet -> (World, Bullet)
|
||||
@@ -162,7 +172,7 @@ hitEffFromBul w bu = case _buEffect bu of
|
||||
hitstream = thingsHit sp (sp + _buVel bu) w
|
||||
|
||||
setFromToDams :: Bullet -> Point2 -> [Damage]
|
||||
setFromToDams bu p = map f (_buDamages bu)
|
||||
setFromToDams bu p = map f (buDamages bu)
|
||||
where
|
||||
f = (dmFrom .~ _buPos bu) . (dmAt .~ p) . (dmTo .~ _buPos bu +.+ _buVel bu)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user