Pass ammo magazine items to held item use chain

This commit is contained in:
2024-06-25 15:50:22 +01:00
parent c723d1b1e1
commit 009a6cd30f
7 changed files with 289 additions and 238 deletions
+3 -3
View File
@@ -58,10 +58,10 @@ updateBulVel bt = case _buTrajectory bt of
-- should be made safe?
-- should be renamed to shootBullet or something
shootBullet :: Item -> Creature -> World -> World
shootBullet it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
shootBullet :: [Item] -> Item -> Creature -> World -> World
shootBullet ams it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
invid <- it ^? itLocation . ipInvID
thebullet <- cr ^? crInv . ix (invid + 1) . itUse . amagParams . ampBullet
thebullet <- ams ^? ix 0 . itUse . amagParams . ampBullet
return $ w & cWorld . lWorld . instantBullets
.:~ ( thebullet
& buPos .~ _crPos cr