diff --git a/src/Dodge/SelectedClose.hs b/src/Dodge/SelectedClose.hs index 33bff5220..deb0a1e82 100644 --- a/src/Dodge/SelectedClose.hs +++ b/src/Dodge/SelectedClose.hs @@ -1,15 +1,22 @@ module Dodge.SelectedClose (getSelectedCloseObj, interactWithCloseObj) where +import Dodge.Inventory import Control.Lens import Dodge.Button.Event import Dodge.Data.World import Dodge.Inventory.Add import NewInt import Data.Maybe +import qualified Data.Map.Strict as M +import qualified SDL -- assumes that, for picking up, you are selecting the item interactWithCloseObj :: Either (NewInt ItmInt) Button -> World -> World interactWithCloseObj e w = worldEventFlags . at InventoryChange ?~ () $ case e of + (Left flit) + | SDL.ScancodeCapsLock `M.member` (w ^. input . pressedKeys) + , Just (Sel 0 j) <- w ^. hud . diSelection + -> scrollAugInvSel 1 $ pickUpItemAt j (i,_unNInt flit) w (Left flit) -> pickUpItem i (_unNInt flit) w (Right but) -> doButtonEvent (but ^. btEvent) but w where diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 57375bc6d..3d513da59 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -536,6 +536,10 @@ pauseGame u = u & uvScreenLayers .~ [pauseMenu u] & pauseSound spaceAction :: World -> World spaceAction w = case w ^. hud . subInventory of + NoSubInventory + | ScancodeCapsLock `M.member` (w ^. input . pressedKeys) + , Just (Sel 0 j) <- w ^. hud . diSelection + -> maybe id interactWithCloseObj (getCloseObj w) w NoSubInventory -> maybe id interactWithCloseObj (getCloseObj w) w _ -> w & hud . subInventory .~ NoSubInventory