diff --git a/src/Dodge/Creature/YourControl.hs b/src/Dodge/Creature/YourControl.hs index dc6e33147..23df83803 100644 --- a/src/Dodge/Creature/YourControl.hs +++ b/src/Dodge/Creature/YourControl.hs @@ -2,6 +2,7 @@ module Dodge.Creature.YourControl ( yourControl, ) where +import Dodge.Inventory import Data.Foldable import qualified Data.Map.Strict as M import Data.Maybe @@ -40,6 +41,12 @@ handleHotkeys w invid <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix invid . itID return $ w & cWorld . lWorld %~ \lw -> foldl' (flip $ assignHotkey itid) lw hks + | SDL.ScancodeLCtrl `M.member` _pressedKeys (_input w) + || SDL.ScancodeRCtrl `M.member` _pressedKeys (_input w) = fromMaybe w $ do + hk <- listToMaybe . mapMaybe scancodeToHotkey $ M.keys $ w ^. input . pressedKeys + itid <- w ^? cWorld . lWorld . hotkeys . ix hk . unNInt + invid <- w ^? cWorld . lWorld . itemLocations . ix itid . ilInvID + return $ w & augInvDirectSelect (0,invid,mempty) | otherwise = M.foldl' useHotkey diff --git a/src/Dodge/TestString.hs b/src/Dodge/TestString.hs index 1bad68abc..0cd61dbe5 100644 --- a/src/Dodge/TestString.hs +++ b/src/Dodge/TestString.hs @@ -26,10 +26,7 @@ import qualified IntMapHelp as IM import qualified Data.Map.Strict as M testStringInit :: Universe -> [String] -testStringInit u = - map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . pjPos) - <> - map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . pjVel) +testStringInit u = [show $ u ^? uvWorld . hud . hudElement . diSelection . _Just] --testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles -- (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls) -- <>