Clear ammo when reloading clip based weaons

This commit is contained in:
2021-12-01 18:37:16 +00:00
parent 016a1faf80
commit 84ccff5344
7 changed files with 18 additions and 39 deletions
+2 -2
View File
@@ -95,8 +95,8 @@ pistol = defaultGun
{ _aoType = basicBullet
, _ammoMax = 15
, _ammoLoaded = 15
, _reloadTime = 10
, _reloadType = PartialActive 1
, _reloadTime = 15
, _reloadType = ActivePartial 1
}
, _itUse = useAmmoParamsRate 8 upHammer
[ ammoCheckI
+3 -3
View File
@@ -38,7 +38,7 @@ module Dodge.Item.Weapon.TriggerType
where
import Dodge.Data
import Dodge.SoundLogic
import Dodge.Creature.Action (startReloadingWeapon)
import Dodge.Reloading
import Dodge.WorldEvent
import Dodge.RandomHelp
--import Dodge.Default
@@ -96,8 +96,8 @@ withThickSmokeI eff item cr w = eff item cr
ammoCheckI :: ChainEffect
ammoCheckI eff item cr w
| _ammoLoaded (_itConsumption item) <= 0 = fromMaybe w (startReloadingWeapon cr w)
| _reloadState (_itConsumption item) /= Nothing' = w
| otherwise = eff item cr w
-- | _reloadState (_itConsumption item) /= Nothing' = w
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading
itUseAmmo :: Int -> Item -> Item
itUseAmmo x = itConsumption . ammoLoaded %~ (max 0 . subtract x)