Start moving hotkeys out from creatures into world
This commit is contained in:
@@ -40,9 +40,10 @@ yourControl _ w
|
||||
handleHotkeys :: World -> World
|
||||
handleHotkeys w
|
||||
| SDL.ButtonRight `M.member` _mouseButtons (_input w) = foldl' tryAssignHotkey w allHotkeys
|
||||
| otherwise = foldl' useHotKey w (M.intersection hotkeys (w ^. input . pressedKeys))
|
||||
| otherwise = foldl' useHotKey w (M.intersection thehotkeys (w ^. input . pressedKeys))
|
||||
where
|
||||
hotkeys = M.mapKeys hotkeyToScancode $ w ^?! cWorld . lWorld . creatures . ix 0 . crHotkeys
|
||||
--thehotkeys = M.mapKeys hotkeyToScancode $ w ^?! cWorld . lWorld . creatures . ix 0 . crHotkeys
|
||||
thehotkeys = M.mapKeys hotkeyToScancode $ w ^. cWorld . lWorld . hotkeys
|
||||
|
||||
useHotKey :: World -> Int -> World
|
||||
useHotKey w invid = useItemHotkey 0 invid w
|
||||
@@ -87,7 +88,8 @@ tryAssignHotkey w sc = fromMaybe w $ do
|
||||
guard (pt == InitialPress)
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
itid <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
return $ w & cWorld . lWorld . creatures . ix 0 %~ assignHotkey itid (scancodeToHotkey sc)
|
||||
--return $ w & cWorld . lWorld . creatures . ix 0 %~ assignHotkey itid (scancodeToHotkey sc)
|
||||
return $ w & cWorld . lWorld %~ assignHotkey itid (scancodeToHotkey sc)
|
||||
|
||||
{- | The order of these MAY be important, in particular the setting of crMvAim
|
||||
within wasdMovement should probably be done first
|
||||
|
||||
Reference in New Issue
Block a user