Re-add twist when reloading, stop reload when full ammo
This commit is contained in:
@@ -73,7 +73,8 @@ wasdDir = foldr ((+.+) . wasdM) (V2 0 0) . _keys
|
|||||||
{- | Set posture according to mouse presses. -}
|
{- | Set posture according to mouse presses. -}
|
||||||
mouseActionsCr :: M.Map SDL.MouseButton Bool -> Creature -> Creature
|
mouseActionsCr :: M.Map SDL.MouseButton Bool -> Creature -> Creature
|
||||||
mouseActionsCr pkeys cr
|
mouseActionsCr pkeys cr
|
||||||
| rbPressed = cr & crStance . posture .~ Aiming
|
| rbPressed && cr ^?! crInvSel . iselAction == NoInvSelAction
|
||||||
|
= cr & crStance . posture .~ Aiming
|
||||||
| otherwise = cr & crStance . posture .~ AtEase
|
| otherwise = cr & crStance . posture .~ AtEase
|
||||||
where
|
where
|
||||||
rbPressed = SDL.ButtonRight `M.member` pkeys
|
rbPressed = SDL.ButtonRight `M.member` pkeys
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction }
|
|||||||
data InvSelAction
|
data InvSelAction
|
||||||
= NoInvSelAction
|
= NoInvSelAction
|
||||||
| ReloadAction { _actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
|
| ReloadAction { _actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
|
||||||
|
deriving (Eq,Ord,Show)
|
||||||
makeLenses ''LoadAction
|
makeLenses ''LoadAction
|
||||||
makeLenses ''InvSel
|
makeLenses ''InvSel
|
||||||
makeLenses ''InvSelAction
|
makeLenses ''InvSelAction
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ tryStartLoading cr = case ic ^? laProgress . _Just . ix 0 of
|
|||||||
Nothing -> case ic ^? laCycle of
|
Nothing -> case ic ^? laCycle of
|
||||||
Nothing -> cr
|
Nothing -> cr
|
||||||
Just [] -> error ("item has empty load cycle" ++ show (cr ^?! crInv . ix (crSel cr) . itType))
|
Just [] -> error ("item has empty load cycle" ++ show (cr ^?! crInv . ix (crSel cr) . itType))
|
||||||
|
Just _ | _laLoaded ic >= _laMax ic -> cr
|
||||||
Just (la:las) -> cr & startLoadAction la
|
Just (la:las) -> cr & startLoadAction la
|
||||||
& crInv . ix (crSel cr) . itConsumption . laProgress ?~ (la:las)
|
& crInv . ix (crSel cr) . itConsumption . laProgress ?~ (la:las)
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user