Allow jumping to hotkey selection
This commit is contained in:
@@ -2,6 +2,7 @@ module Dodge.Creature.YourControl (
|
|||||||
yourControl,
|
yourControl,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Inventory
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
@@ -40,6 +41,12 @@ handleHotkeys w
|
|||||||
invid <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
invid <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||||
itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix invid . itID
|
itid <- w ^? cWorld . lWorld . creatures . ix 0 . crInv . ix invid . itID
|
||||||
return $ w & cWorld . lWorld %~ \lw -> foldl' (flip $ assignHotkey itid) lw hks
|
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 =
|
| otherwise =
|
||||||
M.foldl'
|
M.foldl'
|
||||||
useHotkey
|
useHotkey
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ import qualified IntMapHelp as IM
|
|||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
|
|
||||||
testStringInit :: Universe -> [String]
|
testStringInit :: Universe -> [String]
|
||||||
testStringInit u =
|
testStringInit u = [show $ u ^? uvWorld . hud . hudElement . diSelection . _Just]
|
||||||
map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . pjPos)
|
|
||||||
<>
|
|
||||||
map show (u ^.. uvWorld . cWorld . lWorld . projectiles . each . pjVel)
|
|
||||||
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
--testStringInit u = foldMap prettyShort $ u ^. uvWorld . cWorld . lWorld . projectiles
|
||||||
-- (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls)
|
-- (map (show . _ebPos) $ u ^. uvWorld . cWorld . lWorld . energyBalls)
|
||||||
-- <>
|
-- <>
|
||||||
|
|||||||
Reference in New Issue
Block a user