Readd space action on buttons

This commit is contained in:
2024-11-24 23:34:03 +00:00
parent 7d2a4bf439
commit 9e0f0536e2
9 changed files with 125 additions and 148 deletions
+8 -38
View File
@@ -9,16 +9,13 @@ module Dodge.Inventory (
scrollAugInvSel,
crNumFreeSlots,
crInvSize,
selectedCloseItem,
setInvPosFromSS,
module Dodge.Inventory.RBList,
swapInvItems,
scrollAugNextInSection,
-- isFilteringInv,
swapItemWith,
) where
import Control.Applicative
import Control.Monad
import Data.Function
import qualified Data.IntSet as IS
@@ -123,7 +120,7 @@ updateCloseObjects :: World -> World
updateCloseObjects w =
w
& hud . closeItems %~ f
& hud . closeInterfaces %~ g
& hud . closeButtons %~ g
where
g oldbts = intersect oldbts cbts `union` cbts
f olditems = intersect olditems citems `union` citems
@@ -156,33 +153,6 @@ changeSwapSel yi w
where
f g i m = fst <$> g i m
--changeSwapClose ::
-- (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) ->
-- Int ->
-- World ->
-- World
--changeSwapClose f i w = fromMaybe w $ do
-- ss <- w ^? hud . hudElement . diSections . ix 3 . ssItems
-- k <- f i ss
-- let doswap j
-- | j == i = k
-- | j == k = i
-- | otherwise = j
-- return $
-- w
-- & swapAnyExtraSelection i k
-- & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . ispCloseItem
-- %~ doswap
-- & hud . closeItems %~ swapIndices i k
-- & hud . hudElement . diSelection . _Just . _2 %~ doswap
-- & worldEventFlags . at InventoryChange ?~ ()
--changeSwapClose' ::
-- (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) ->
-- Int ->
-- World ->
-- World
changeSwapOther ::
((Int -> Identity Int) -> ManipulatedObject -> Identity ManipulatedObject) ->
Int ->
@@ -334,10 +304,10 @@ scrollAugNextInSection w =
sss <- he ^? diSections
return $ he & diSelection %~ nextInSectionSS sss
selectedCloseItem :: World -> Maybe FloorItem
selectedCloseItem w = do
i <-
you w ^? crManipulation . manObject . ispCloseItem
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . ix 3 . ssItems)
flitid <- w ^? hud . closeItems . ix i . unNInt
w ^? cWorld . lWorld . floorItems . unNIntMap . ix flitid
--selectedCloseItem :: World -> Maybe FloorItem
--selectedCloseItem w = do
-- i <-
-- you w ^? crManipulation . manObject . ispCloseItem
-- <|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . ix 3 . ssItems)
-- flitid <- w ^? hud . closeItems . ix i . unNInt
-- w ^? cWorld . lWorld . floorItems . unNIntMap . ix flitid