Rethink item ammo to item consumables, start item type datatype

This commit is contained in:
2021-11-29 16:22:31 +00:00
parent 3a605b8156
commit f40d486d68
31 changed files with 238 additions and 193 deletions
+3 -2
View File
@@ -144,7 +144,7 @@ invSideEff cr w = weaponReloadSounds cr $ IM.foldrWithKey f w (_crInv cr)
itpointer = creatures . ix (_crID cr) . crInv . ix i
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . wpAmmo of
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption of
Just am@LoadableAmmo{} -> case _wpReloadType am of
PassiveReload stype |_wpReloadTime am ==_wpReloadState am
-> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
@@ -153,6 +153,7 @@ weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . wpAmmo of
ActiveReload | _wpReloadState am == 0 -> w
ActiveReload -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
Just ChargeableAmmo {} -> w
Just ItemItselfConsumable {} -> w
Nothing -> w
where
cid = _crID cr
@@ -185,7 +186,7 @@ isFrictionless cr = case cr ^? crStance . carriage of
_ -> False
stepReloading :: Creature -> Creature
stepReloading cr = over (crInv . ix iSel . wpAmmo . wpReloadState) decreaseToZero cr
stepReloading cr = over (crInv . ix iSel . itConsumption . wpReloadState) decreaseToZero cr
where
iSel = _crInvSel cr