Clear ammo when reloading clip based weaons
This commit is contained in:
@@ -7,7 +7,7 @@ module Dodge.Creature.Action
|
||||
, setMinInvSize
|
||||
, dropUnselected
|
||||
, dropExcept
|
||||
, startReloadingWeapon
|
||||
-- , startReloadingWeapon
|
||||
, blinkAction
|
||||
, sizeSelf
|
||||
, crAutoReload
|
||||
@@ -144,17 +144,6 @@ performAction cr w ac = case ac of
|
||||
(imps , _) -> (imps, Just $ DoReplicatePartial sac (t-1) sac)
|
||||
NoAction -> ([],Nothing)
|
||||
|
||||
startReloadingWeapon :: Creature -> World -> Maybe World
|
||||
startReloadingWeapon cr w = case it of
|
||||
Weapon {_itConsumption = LoadableAmmo {_ammoMax=maxA,_ammoLoaded=lA ,_reloadState=rS,_reloadTime=rT}}
|
||||
| lA < maxA && rS == Nothing' ->
|
||||
Just -- $ set ( itRef . itConsumption . ammoLoaded) maxA
|
||||
$ set ( itRef . itConsumption . reloadState) (Just' rT) w
|
||||
_ -> Nothing
|
||||
where
|
||||
cid = _crID cr
|
||||
it = _crInv cr IM.! _crInvSel cr
|
||||
itRef = creatures . ix cid . crInv . ix (_crInvSel cr)
|
||||
{- | Start reloading if clip is empty. -}
|
||||
crAutoReload :: Creature -> Creature
|
||||
crAutoReload cr = case cr ^? ptrItConsumption' . ammoLoaded of
|
||||
|
||||
Reference in New Issue
Block a user