Decouple selection section inventory position

This commit is contained in:
2024-10-24 14:55:51 +01:00
parent 81f4f38166
commit 388064895f
17 changed files with 304 additions and 261 deletions
+6 -6
View File
@@ -30,7 +30,7 @@ regexScope ::
Maybe
((SSSExtra -> f SSSExtra) -> HUDElement -> f HUDElement, Int)
regexScope w = case w ^? hud . hudElement . subInventory of
Just NoSubInventory{} -> case he ^? diSections . sssExtra . sssSelPos . _Just of
Just NoSubInventory{} -> case he ^? diSelection . _Just of
Just (-1, _) -> di (-1)
Just (0, _) -> di (-1)
Just (2, _) -> di 2
@@ -49,7 +49,7 @@ regexFocus ::
Maybe
((SSSExtra -> f SSSExtra) -> HUDElement -> f HUDElement, Int)
regexFocus w = case w ^? hud . hudElement . subInventory of
Just NoSubInventory{} -> case he ^? diSections . sssExtra . sssSelPos . _Just of
Just NoSubInventory{} -> case he ^? diSelection . _Just of
Just (-1, _) -> di (-1)
Just (2, _) -> di 2
_ -> Nothing
@@ -71,11 +71,11 @@ inputFocus ::
World ->
Maybe ((String -> f String) -> World -> f World)
inputFocus w = case w ^? hud . hudElement . subInventory of
Just NoSubInventory{} -> case he ^? diSections . sssExtra . sssSelPos . _Just of
Just NoSubInventory{} -> case he ^? diSelection . _Just of
Just (-1, _) -> di (-1)
Just (2, _) -> di 2
_ -> Nothing
Just CombineInventory{} -> case he ^? subInventory . ciSections . sssExtra . sssSelPos . _Just of
Just CombineInventory{} -> case he ^? subInventory . ciSelection . _Just of
Just (-1, _) -> Just $ hud . hudElement . subInventory . ciSections . sssExtra . sssFilters . ix (-1) . _Just
_ -> Nothing
Just DisplayTerminal{_termID = tmid} -> do
@@ -90,7 +90,7 @@ inputFocus w = case w ^? hud . hudElement . subInventory of
inTopRegex :: Int -> World -> Bool
inTopRegex x w = fromMaybe False $ do
i <- w ^? hud . hudElement . diSections . sssExtra . sssSelPos . _Just . _1
i <- w ^? hud . hudElement . diSelection . _Just . _1
return $ i == x
inInvRegex :: World -> Bool
@@ -101,7 +101,7 @@ inCloseRegex = inTopRegex 2
inSubInvRegex :: World -> Bool
inSubInvRegex w = fromMaybe False $ do
i <- w ^? hud . hudElement . subInventory . ciSections . sssExtra . sssSelPos . _Just . _1
i <- w ^? hud . hudElement . subInventory . ciSelection . _Just . _1
return $ i == (-1)
--inputFocus :: World -> Bool