Continue refactoring reloading

This commit is contained in:
2022-06-21 13:06:55 +01:00
parent 37eb69c661
commit 14a7189b44
12 changed files with 80 additions and 60 deletions
+1 -2
View File
@@ -317,6 +317,5 @@ pickUpItemID cid flid w = pickUpItem cid (_floorItems w IM.! flid) w
{- | Pick up a specific item. -}
pickUpItem :: Int -> FloorItem -> World -> World
pickUpItem cid flit w = maybe w (soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing)
. fmap snd
pickUpItem cid flit w = maybe w (soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing . snd)
$ tryPutItemInInv cid flit w
+3 -1
View File
@@ -28,7 +28,9 @@ data FootForward
| WasRightForward
deriving
(Eq,Ord,Show)
data Posture = Aiming | Reloading | AtEase
data Posture = Aiming
| Reloading
| AtEase
deriving
(Eq,Ord,Show)
+7 -9
View File
@@ -230,11 +230,9 @@ doItemTargeting invid cr w = case cr ^? crInv . ix invid . itTargeting of
in w' & creatures . ix (_crID cr) . crInv . ix invid . itTargeting .~ t'
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption of
Just am@LoadableAmmo{} -> case am ^? laProgress of
Just FinishedLoading -> w -- stopSoundFrom (CrReloadSound cid) w
Just _ -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
Nothing -> w
weaponReloadSounds cr w = case cr ^? crInvSelAction of
Just ReloadAction{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
_ -> w
-- PassiveReload stype | Just (_laReloadTime am) == am ^? laTransfer . transferTime
-- -> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
-- PassiveReload _ -> w
@@ -244,10 +242,10 @@ weaponReloadSounds cr w = case cr ^? crInv . ix (_crInvSel cr) . itConsumption o
-- ActivePartial{} | am ^? laTransfer . transferTime == Just 0 -> stopSoundFrom (CrReloadSound cid) w
-- ActivePartial{} | _laTransfer am == NoTransfer -> w
-- ActivePartial{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
Just ChargeableAmmo {} -> w
Just NoConsumption {} -> w
Just ItemItselfConsumable {} -> w
Nothing -> w
-- Just ChargeableAmmo {} -> w
-- Just NoConsumption {} -> w
-- Just ItemItselfConsumable {} -> w
-- Nothing -> w
where
cid = _crID cr
+3
View File
@@ -28,6 +28,9 @@ crIsReloading cr = case cr ^? crStance . posture of
Just Reloading -> True
_ -> False
crWeaponReady :: Creature -> Bool
crWeaponReady cr = isNothing $ cr ^? crInv . ix (_crInvSel cr) . itConsumption . laProgress . _Just
crCanSeeCr :: Creature -> (World, Creature) -> Bool
crCanSeeCr tcr (w,cr) = hasLOS (_crPos cr) (_crPos tcr) w