Tweak inventory management
This commit is contained in:
@@ -9,6 +9,7 @@ import Dodge.Creature.Action
|
||||
import Dodge.Event.Test
|
||||
import Dodge.Event.Menu
|
||||
import Dodge.Menu
|
||||
import Dodge.Inventory
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
import SDL
|
||||
@@ -65,13 +66,14 @@ gotoTerminal w = case _menuLayers w of
|
||||
spaceAction :: World -> World
|
||||
spaceAction w = if _carteDisplay w
|
||||
then w & carteCenter .~ theLoc
|
||||
else case (_inventoryMode w, listToMaybe $ _closeObjects w) of
|
||||
(TopInventory,Just (Left flit)) -> pickUpItem 0 flit w
|
||||
(TopInventory,Just (Right but)) -> updateTopCloseObject (_btID but) $ _btEvent but but w
|
||||
else case (_inventoryMode w, selectedCloseObject w) of
|
||||
(TopInventory,(Just (_,Left flit))) -> pickUpItem 0 flit w
|
||||
--(TopInventory,(Just (_,Right but))) -> updateTopCloseObject (_btID but) $ _btEvent but but w
|
||||
(TopInventory,(Just (_,Right but))) -> _btEvent but but w
|
||||
_ -> w & inventoryMode .~ TopInventory
|
||||
where
|
||||
theLoc = fst (_seenLocations w IM.! _selLocation w) w
|
||||
updateTopCloseObject i w' = w' & closeObjects %~ ( Right (_buttons w' IM.! i) : ) . tail
|
||||
-- updateTopCloseObject i w' = w' & closeObjects %~ ( Right (_buttons w' IM.! i) : ) . tail
|
||||
|
||||
pauseGame :: World -> World
|
||||
pauseGame w = w & sideEffects %~ (. (menuLayers .~ [pauseMenu]))
|
||||
|
||||
Reference in New Issue
Block a user