Continue inventory refactor

This commit is contained in:
2024-11-24 22:08:36 +00:00
parent 81fcfea1be
commit 82c53fc8e3
10 changed files with 187 additions and 149 deletions
+10 -1
View File
@@ -4,6 +4,7 @@ module Dodge.Render.HUD (
drawHUD,
) where
import NewInt
import Control.Applicative
import Control.Lens
import Control.Monad
@@ -217,7 +218,15 @@ floorItemPickupInfo n itm
yourAugmentedItem :: (Item -> a) -> a -> (Either FloorItem Button -> a) -> World -> a
yourAugmentedItem f x g w = case you w ^? crManipulation . manObject of
Just (SelectedItem i _ _) -> f $ yourInv w ^?! ix i
Just (SelCloseObject i) -> g . Left $ w ^?! hud . closeItems . ix i
Just (SelCloseItem i) -> fromMaybe x $ do
j <- w ^? hud . closeItems . ix i . unNInt
flit <- w ^? cWorld . lWorld . floorItems . unNIntMap . ix j
return . g $ Left flit
-- g . Left $ w ^?! hud . closeItems . ix i
Just (SelCloseButton i) -> fromMaybe x $ do
j <- w ^? hud . closeInterfaces . ix i
flit <- w ^? cWorld . lWorld . buttons . ix j
return . g $ Right flit
_ -> x
drawRBOptions :: Configuration -> World -> Picture