Continue mouse context refactor
This commit is contained in:
@@ -88,20 +88,15 @@ updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . hudEleme
|
||||
& ciFilter .~ filts'
|
||||
|
||||
updateMouseClickInGame :: World -> World
|
||||
updateMouseClickInGame w = if w ^? input . mouseButtons . ix ButtonLeft == Just 0
|
||||
then updateMouseClickInGame' w
|
||||
else w
|
||||
updateMouseClickInGame w = case w ^? input . mouseButtons . ix ButtonLeft of
|
||||
Just 0 -> updateMouseClickInGame' w
|
||||
Just _ -> w
|
||||
Nothing -> w
|
||||
|
||||
updateMouseClickInGame' :: World -> World
|
||||
updateMouseClickInGame' w = case w ^. input . mouseContext of
|
||||
OverTerminalReturn -> fromMaybe w $ do
|
||||
tmid <- w ^? hud . hudElement . subInventory . termID
|
||||
tm <- w ^? cWorld . lWorld . terminals . ix tmid
|
||||
guard (_tmStatus tm == TerminalReady)
|
||||
s <- tm ^? tmInput . tiText
|
||||
return $ if null (words s) && null (_tmPartialCommand tm)
|
||||
then w
|
||||
else terminalReturnEffect tm w
|
||||
OverInvSelect (i,j) -> w
|
||||
OverTerminalReturn tmid -> terminalReturnEffect tmid w
|
||||
OverTerminalEscape -> w
|
||||
& hud . hudElement . subInventory .~ NoSubInventory MouseInvNothing
|
||||
OverCombSelect x ->
|
||||
@@ -183,7 +178,7 @@ updateKeysInTerminal tmid u =
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
checkEndStatus
|
||||
| pkeys ^. at ScancodeReturn == Just InitialPress =
|
||||
over uvWorld (\w -> terminalReturnEffect (w ^?! cWorld . lWorld . terminals . ix tmid) w)
|
||||
over uvWorld (\w -> terminalReturnEffect tmid w)
|
||||
| otherwise = id
|
||||
|
||||
updateKeyInGame :: Universe -> Scancode -> PressType -> Universe
|
||||
|
||||
Reference in New Issue
Block a user