Fix minigun inter-frame bullet speed

This commit is contained in:
2024-06-22 11:42:33 +01:00
parent a9ac974a2c
commit 35a56eef56
7 changed files with 96 additions and 80 deletions
+3 -4
View File
@@ -1,6 +1,6 @@
module Dodge.Bullet (
updateBullet,
useAmmoParams,
shootBullet,
) where
import Linear
@@ -58,8 +58,8 @@ updateBulVel bt = case _buTrajectory bt of
-- should be made safe?
-- should be renamed to shootBullet or something
useAmmoParams :: Item -> Creature -> World -> World
useAmmoParams it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
shootBullet :: Item -> Creature -> World -> World
shootBullet it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
invid <- it ^? itLocation . ipInvID
thebullet <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoParams . ampBullet
return $ w & cWorld . lWorld . instantBullets
@@ -72,7 +72,6 @@ useAmmoParams it cr w = fromMaybe (error "cannot find bullet ammo when expected
where
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
dir = _crDir cr
bultype = _laAmmoType $ _heldConsumption $ _itUse it
muzvel = _muzVel $ _heldParams $ _itUse it
muzlength = aimingMuzzlePos cr it
settrajectory traj = case traj of