This commit is contained in:
2025-08-27 18:55:25 +01:00
parent 86696deb56
commit 40d2d316cb
35 changed files with 316 additions and 431 deletions
+7 -15
View File
@@ -6,27 +6,19 @@ import Dodge.Data.World
import LensHelp
inTextInputFocus :: World -> Bool
inTextInputFocus = isJust . inputFocusI
inTextInputFocus = isJust . textInputFocus
inputFocusI :: World -> Maybe ((String -> Identity String) -> World -> Identity World)
inputFocusI = textInputFocus
textInputFocus ::
Applicative f =>
World ->
Maybe ((String -> f String) -> World -> f World)
textInputFocus w = case w ^? hud . subInventory of
Just NoSubInventory{} -> case he ^? diSelection . _Just . slSec of
textInputFocus :: World -> Maybe ((String -> Identity String) -> World -> Identity World)
textInputFocus w = case w ^. hud . subInventory of
NoSubInventory{} -> case he ^? diSelection . _Just . slSec of
Just (-1) -> Just $ hud . diInvFilter . _Just
Just 2 -> Just $ hud . diCloseFilter . _Just
_ -> Nothing
Just CombineInventory{} -> case he ^? subInventory . ciSelection . _Just . slSec of
CombineInventory{} -> case he ^? subInventory . ciSelection . _Just . slSec of
Just (-1) -> Just $ hud . subInventory . ciFilter . _Just
_ -> Nothing
Just DisplayTerminal{_termID = tmid} -> do
-- connectionstatus <- w ^? cWorld . lWorld . terminals . ix tmid . tmStatus
-- guard $ connectionstatus == TerminalTextInput
return $ cWorld . lWorld . terminals . ix tmid . tmStatus . tiText
DisplayTerminal{_termID = tmid} -> return
$ cWorld . lWorld . terminals . ix tmid . tmStatus . tiText
_ -> Nothing
where
he = w ^. hud