Reorganise/cleanup

This commit is contained in:
2023-02-21 01:24:22 +00:00
parent dee7472d31
commit 4904c57972
13 changed files with 119 additions and 140 deletions
+6 -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 . fssSections >>=
selNumPos mo w = w ^? hud . hudElement . diSections >>=
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 . fssSections . sssSections . ix 3 . ssItems . ix i)
| isNothing (w ^? hud . hudElement . diSections . 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 . fssSections %~ scrollSelectionSections yi
w & hud . hudElement . diSections %~ scrollSelectionSections yi
& setInvPosFromSS
setInvPosFromSS :: World -> World
@@ -354,8 +354,8 @@ setInvPosFromSS w = w
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ thesel
where
thesel = fromMaybe SelNothing $ do
sss <- w ^? hud . hudElement . diSections . fssSections
(i,j) <- sss ^? sssSelPos . _Just
sss <- w ^? hud . hudElement . diSections
(i,j) <- sss ^? sssExtra . sssSelPos . _Just
case i of
(-1) -> Just $ InInventory SortInventory
0 -> Just $ InInventory (SelItem j NoInvSelAction)
@@ -368,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 . fssSections . sssSections . ix 3 . ssItems)
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems)
w ^? hud . closeObjects . ix i