Add missing dependencies, fix arc rendering

This commit is contained in:
2021-08-28 16:22:21 +01:00
parent 4e97a1998c
commit c36654520d
9 changed files with 77 additions and 15 deletions
+48
View File
@@ -0,0 +1,48 @@
module Dodge.Item.Weapon.AmmoParams
where
import Dodge.Data
import Dodge.Particle.Bullet.Spawn
import Geometry
import Control.Lens
useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it = withVelWthHiteff (_amBulVel b) (_amBulWth b) (_amBulEff b)
where
b = _wpAmmo it
useAmmoParamsVelMod :: Float -> Item -> Creature -> World -> World
useAmmoParamsVelMod vfact it = withDelayedVelWthHiteff vfact (_amBulVel b) (_amBulWth b) (_amBulEff b)
where
b = _wpAmmo it
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
withVelWthHiteff
:: Point2 -- ^ Velocity, x direction is forward with respect to the creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
withVelWthHiteff vel width hiteff cr = over particles (newbul : )
where
cid = _crID cr
newbul = aGenBulAt (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
{- | Creates a bullet with a given velocity, width, and 'HitEffect' -}
withDelayedVelWthHiteff
:: Float -- ^ Velocity factor for first step
-> Point2 -- ^ Velocity, x direction is forward with respect to the creature
-> Float -- ^ Bullet width
-> HitEffect -- ^ Bullet effect when hitting creature, wall etc
-> Creature -- ^ Creature id
-> World
-> World
withDelayedVelWthHiteff vfact vel width hiteff cr = over particles (newbul : )
where
cid = _crID cr
newbul = aDelayedBulAt vfact (Just cid) pos (rotateV dir vel) hiteff width
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)