Add weapon fail fire sound
This commit is contained in:
@@ -138,14 +138,17 @@ withThickSmokeI eff item cr w =
|
|||||||
ammoCheckI :: ChainEffect
|
ammoCheckI :: ChainEffect
|
||||||
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
||||||
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia)
|
Just (InternalSource ia) | _iaLoaded ia <= 0 || not (_iaPrimed ia)
|
||||||
-> w
|
-> failsound w
|
||||||
Just AboveSource | fromMaybe True $ do
|
Just AboveSource | fromMaybe True $ do
|
||||||
invid <- itm ^? itLocation . ipInvID
|
invid <- itm ^? itLocation . ipInvID
|
||||||
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
x <- cr ^? crInv . ix (invid - 1) . itUse . equipEffect . eeUse . euseAmmoAmount
|
||||||
return $ x <= 0
|
return $ x <= 0
|
||||||
-> w
|
-> failsound w
|
||||||
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||||
|
where
|
||||||
|
failsound = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
|
Just 0 -> soundStart (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||||
|
_ -> soundContinue (CrReloadSound (_crID cr)) (_crPos cr) click1S Nothing
|
||||||
|
|
||||||
itUseCharge :: Int -> Item -> Item
|
itUseCharge :: Int -> Item -> Item
|
||||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||||
|
|||||||
Reference in New Issue
Block a user