Commit before changing TerminalCommand to produce [TerminalLine]

This commit is contained in:
2022-06-06 20:25:38 +01:00
parent b20502bc35
commit 1fe41889fe
8 changed files with 32 additions and 28 deletions
+4 -4
View File
@@ -37,9 +37,9 @@ handleTextInput text u = return . Just $ u
where
updateTerminalText = case u ^? uvWorld . hud . hudElement . subInventory of
Just (DisplayTerminal tmid) | hasfocus tmid
-> uvWorld . terminals . ix tmid . tmInput . _Just . tiText %~ updateText
-> uvWorld . terminals . ix tmid . tmInput . tiText %~ updateText
_ -> id
hasfocus tmid = fromMaybe False $ u ^? uvWorld . terminals . ix tmid . tmInput . _Just . tiFocus
hasfocus tmid = fromMaybe False $ u ^? uvWorld . terminals . ix tmid . tmInput . tiFocus
updateText s = case T.unpack text of
";" -> s
_ -> s `T.append` T.toUpper text
@@ -90,10 +90,10 @@ handlePressedKeyInGame scode w = case scode of
handlePressedKeyTerminal :: Int -> Scancode -> World -> Maybe World
handlePressedKeyTerminal tmid scode w = case scode of
ScancodeEscape -> Just $ w & terminals . ix tmid . tmInput . _Just . tiFocus %~ const False
ScancodeEscape -> Just $ w & terminals . ix tmid . tmInput . tiFocus %~ const False
ScancodeReturn -> Just $ w & doTerminalEffect (w ^?! terminals . ix tmid)
ScancodeBackspace -> Just $ w
& terminals . ix tmid . tmInput . _Just . tiText %~ doBackspace
& terminals . ix tmid . tmInput . tiText %~ doBackspace
& backspaceTimer .~ 5
_ -> Just w
where