Continue refactoring reloading
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user