Implement terminals
This commit is contained in:
+18
-13
@@ -50,14 +50,14 @@ handlePressedKeyInGame scode w = case scode of
|
||||
ScancodeM -> Just $ toggleMap w
|
||||
ScancodeR -> Just $ fromMaybe w $ startReloadingWeapon (you w) w
|
||||
ScancodeT -> Just $ testEvent w
|
||||
ScancodeX -> Just $ w & inventoryMode %~ toggleInv TweakInventory
|
||||
ScancodeX -> Just $ w & hud . hudElement %~ toggleInv (DisplayInventory TweakInventory)
|
||||
ScancodeC -> Just $ toggleCombineInv w
|
||||
ScancodeI -> Just $ w & inventoryMode %~ toggleInv InspectInventory
|
||||
ScancodeI -> Just $ w & hud . hudElement %~ toggleInv (DisplayInventory InspectInventory)
|
||||
_ -> Just w
|
||||
|
||||
toggleInv :: InventoryMode -> InventoryMode -> InventoryMode
|
||||
toggleInv :: HUDElement -> HUDElement -> HUDElement
|
||||
toggleInv x y
|
||||
| x == y = TopInventory
|
||||
| x == y = DisplayInventory NoSubInventory
|
||||
| otherwise = x
|
||||
|
||||
gotoTerminal :: Universe -> Universe
|
||||
@@ -66,13 +66,14 @@ gotoTerminal w = case _menuLayers w of
|
||||
_ -> w & menuLayers %~ (InputScreen [] :)
|
||||
|
||||
spaceAction :: World -> World
|
||||
spaceAction w = if _carteDisplay w
|
||||
then w & carteCenter .~ theLoc
|
||||
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
|
||||
spaceAction w = case _hudElement $ _hud w of
|
||||
DisplayCarte -> w & hud . carteCenter .~ theLoc
|
||||
DisplayInventory NoSubInventory -> case selectedCloseObject w of
|
||||
Just (_,Left flit) -> pickUpItem 0 flit w
|
||||
Just (_,Right but) -> _btEvent but but w
|
||||
_ -> w
|
||||
DisplayInventory DisplayTerminal {} -> w & hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
_ -> w & hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
where
|
||||
theLoc = fst (_seenLocations w IM.! _selLocation w) w
|
||||
-- updateTopCloseObject i w' = w' & closeObjects %~ ( Right (_buttons w' IM.! i) : ) . tail
|
||||
@@ -81,6 +82,10 @@ pauseGame :: World -> World
|
||||
pauseGame w = w & sideEffects %~ (. (menuLayers .~ [pauseMenu]))
|
||||
|
||||
toggleMap :: World -> World
|
||||
toggleMap w = w & carteDisplay %~ not
|
||||
toggleMap w = case _hudElement $ _hud w of
|
||||
DisplayCarte -> w & hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
_ -> w & hud . hudElement .~ DisplayCarte
|
||||
escapeMap :: World -> World
|
||||
escapeMap w = w & carteDisplay .~ False
|
||||
escapeMap w = case _hudElement $ _hud w of
|
||||
DisplayCarte -> w & hud . hudElement .~ DisplayInventory NoSubInventory
|
||||
_ -> w
|
||||
|
||||
Reference in New Issue
Block a user