Move bullet modifications from weapons to magazines

This commit is contained in:
2024-06-22 10:40:11 +01:00
parent a3eca3a674
commit a9ac974a2c
18 changed files with 254 additions and 277 deletions
+5 -3
View File
@@ -59,9 +59,11 @@ 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 =
w & cWorld . lWorld . instantBullets
.:~ ( _amBullet bultype
useAmmoParams 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
.:~ ( thebullet
& buPos .~ _crPos cr
& buTrajectory %~ settrajectory
& buVel %~ (rotateV dir . (muzvel *.*))