Start unifying regex parts of selection sections

This commit is contained in:
2023-02-20 18:20:48 +00:00
parent c3fb94c7b5
commit 7b9b1d1799
12 changed files with 90 additions and 136 deletions
+5 -6
View File
@@ -106,7 +106,7 @@ rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crMan
Nothing -> w
selNumPos :: ManipulatedObject -> World -> Maybe Int
selNumPos mo w = w ^? hud . hudElement . diSections >>=
selNumPos mo w = w ^? hud . hudElement . diSections . fssSections >>=
case mo of
InInventory SortInventory -> selSecSelPos (-1) 0
InInventory (SelItem i _) -> selSecSelPos 0 i
@@ -164,7 +164,7 @@ updateCloseObjects w =
= case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject. inNearby . ispCloseObject of
Just i
| i >= length newcloseobjects -> scrollAugInvSel 1
| isNothing (w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems . ix i)
| isNothing (w ^? hud . hudElement . diSections . fssSections . sssSections . ix 3 . ssItems . ix i)
-> scrollAugInvSel (-1)
_ -> id
filt = filter $ \obj -> dist ypos (closeObjPos obj) < 40 && hasButtonLOS ypos (closeObjPos obj) w
@@ -346,7 +346,7 @@ scrollAugInvSel :: Int -> World -> World
scrollAugInvSel yi w
| yi == 0 = w
| otherwise =
w & hud . hudElement . diSections %~ scrollSelectionSections yi
w & hud . hudElement . diSections . fssSections %~ scrollSelectionSections yi
& setInvPosFromSS
setInvPosFromSS :: World -> World
@@ -354,9 +354,8 @@ setInvPosFromSS w = w
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ thesel
where
thesel = fromMaybe SelNothing $ do
sss <- w ^? hud . hudElement . diSections
sss <- w ^? hud . hudElement . diSections . fssSections
(i,j) <- sss ^? sssSelPos . _Just
-- j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
case i of
(-1) -> Just $ InInventory SortInventory
0 -> Just $ InInventory (SelItem j NoInvSelAction)
@@ -369,5 +368,5 @@ setInvPosFromSS w = w
selectedCloseObject :: World -> Maybe (Either FloorItem Button)
selectedCloseObject w = do
i <- you w ^? crManipulation . manObject . inNearby . ispCloseObject
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems)
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . fssSections . sssSections . ix 3 . ssItems)
w ^? hud . closeObjects . ix i