Start collapsing manipulated item code with selection code
This commit is contained in:
@@ -38,9 +38,10 @@ handleHotkeys :: World -> World
|
||||
handleHotkeys w
|
||||
| ispressed SDL.ScancodeLShift || ispressed SDL.ScancodeRShift
|
||||
, (hk : _) <- mapMaybe scancodeToHotkey . M.keys $ pkeys
|
||||
, Just invid <- w ^? hud . manObject . imSelectedItem
|
||||
, Just (Sel 0 invid) <- w ^. hud .diSelection
|
||||
--revise2 , Just invid <- w ^? hud . manObject . imSelectedItem
|
||||
--revise1 , Just invid <- lw ^? creatures . ix 0 . crManipulation . manObject . imSelectedItem
|
||||
, Just itid <- lw ^? creatures . ix 0 . crInv . ix invid =
|
||||
, Just itid <- lw ^? creatures . ix 0 . crInv . ix (NInt invid) =
|
||||
w & cWorld . lWorld %~ assignHotkey (NInt itid) hk
|
||||
| ispressed SDL.ScancodeLCtrl || ispressed SDL.ScancodeRCtrl
|
||||
, (hk : _) <- mapMaybe scancodeToHotkey . M.keys $ pkeys
|
||||
@@ -212,7 +213,8 @@ tryClickUse pkeys w = fromMaybe w $ do
|
||||
ltime <- pkeys ^? ix SDL.ButtonLeft
|
||||
rtime <- pkeys ^? ix SDL.ButtonRight
|
||||
guard $ ltime <= rtime
|
||||
case w ^?hud. manObject . imSelectedItem . unNInt of
|
||||
case w ^.hud.diSelection of
|
||||
--revise2 case w ^?hud. manObject . imSelectedItem . unNInt of
|
||||
--revise1 case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . imSelectedItem . unNInt of
|
||||
Just invid -> useItem invid ltime w
|
||||
Nothing -> interactWithCloseObj <$> getSelectedCloseObj w ?? w
|
||||
Just (Sel 0 invid) -> useItem invid ltime w
|
||||
_ -> interactWithCloseObj <$> getSelectedCloseObj w ?? w
|
||||
|
||||
Reference in New Issue
Block a user