Stop group selection on unsuitable sections

This commit is contained in:
2024-11-25 22:26:28 +00:00
parent 9da80a0429
commit 6658aa7a0a
+11 -1
View File
@@ -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 ->