Allow jumping to hotkey selection
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user