From 6658aa7a0a912ebfe80d8be7e467959808eb2c41 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 25 Nov 2024 22:26:28 +0000 Subject: [PATCH] Stop group selection on unsuitable sections --- src/Dodge/Update/Input/InGame.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index 22ca90df8..2dd1685db 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE LambdaCase #-} module Dodge.Update.Input.InGame ( updateUseInputInGame, updateMouseInGame, @@ -159,16 +160,25 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of (yss, _) = IM.split (max i j + 1) xss return . IM.keysSet $ yss +isGroupSelectableSection :: Int -> Bool +isGroupSelectableSection = \case + 0 -> True + 3 -> True + _ -> False + updateMouseClickInGame :: Configuration -> World -> World updateMouseClickInGame cfig w = case w ^. input . mouseContext of MouseInGame -> fromMaybe w $ do sss <- w ^? hud . hudElement . diSections ysel <- inverseSelSecYint (posSelSecYint cfig ldp (mpos ^. _y)) sss + guard (isGroupSelectableSection $ fst ysel) return $ w & input . mouseContext .~ OverInvDragSelect ysel Nothing OverInvSelect x | ScancodeLShift `M.member` (w ^. input . pressedKeys ) - -> w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x) + -> fromMaybe w $ do + guard (isGroupSelectableSection $ fst x) + return $ w & input . mouseContext .~ OverInvDragSelect x (Just $ snd x) OverInvSelect x -> startDrag x cfig w OverTerminalReturn tmid -> terminalReturnEffect tmid w OverTerminalEscape ->