Refactor floor items to use centralised items intmap
This commit is contained in:
@@ -6,18 +6,16 @@ import Dodge.Data.World
|
||||
import Dodge.Inventory.Add
|
||||
import NewInt
|
||||
|
||||
interactWithCloseObj :: Either FloorItem Button -> World -> World
|
||||
interactWithCloseObj :: Either (NewInt ItmInt) Button -> World -> World
|
||||
interactWithCloseObj e w = worldEventFlags . at InventoryChange ?~ () $ case e of
|
||||
(Left flit) -> pickUpItem 0 flit w
|
||||
(Left flit) -> pickUpItem 0 (_unNInt flit) w
|
||||
(Right but) -> doButtonEvent (but ^. btEvent) but w
|
||||
|
||||
getSelectedCloseObj :: World -> Maybe (Either FloorItem Button)
|
||||
getSelectedCloseObj :: World -> Maybe (Either (NewInt ItmInt) Button)
|
||||
getSelectedCloseObj w = do
|
||||
(i, j, _) <- w ^? hud . hudElement . diSelection . _Just
|
||||
case i of
|
||||
3 -> do
|
||||
NInt k <- w ^? hud . closeItems . ix j
|
||||
fmap Left $ w ^? cWorld . lWorld . floorItems . ix k
|
||||
3 -> Left <$> w ^? hud . closeItems . ix j
|
||||
5 -> do
|
||||
k <- w ^? hud . closeButtons . ix j
|
||||
fmap Right $ w ^? cWorld . lWorld . buttons . ix k
|
||||
|
||||
Reference in New Issue
Block a user