Work on toggle terminals
This commit is contained in:
+11
-11
@@ -9,7 +9,7 @@ module Dodge.Terminal (
|
||||
sensorCommand,
|
||||
makeColorTermLine,
|
||||
makeTermPara,
|
||||
toggleCommand,
|
||||
-- toggleCommand,
|
||||
terminalReturnEffect,
|
||||
getCommands,
|
||||
tabComplete,
|
||||
@@ -59,9 +59,9 @@ getCommand :: World
|
||||
-> Terminal -> TCom -> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
getCommand w tm = \case
|
||||
TCInfo x z -> PTE.singleton x (PTE.singleton "" (makeTermPara z))
|
||||
TCBase -> helpCommand <> quitCommand
|
||||
TCBase -> helpCommand <> quitCommand <> toggleCommands tm
|
||||
TCDamageCommand -> damageCodeCommand w
|
||||
TCToggles -> toggleCommand tm
|
||||
-- TCToggles -> toggleCommand tm
|
||||
TCSensorInfo -> sensorCommand w tm
|
||||
|
||||
damageCodeCommand :: World -> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
@@ -92,18 +92,18 @@ sensorCommand w tm = PTE.singleton "SENSOR" $ fromMaybe mempty $ do
|
||||
]
|
||||
|
||||
|
||||
toggleCommand :: Terminal -> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
toggleCommand tm =
|
||||
PTE.singleton "TOGGLE" $
|
||||
PTE.fromList $
|
||||
M.toList $ fmap f $ tm ^. tmToggles
|
||||
toggleCommands :: Terminal -> PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
toggleCommands tm
|
||||
| null ts = mempty
|
||||
| otherwise = PTE.singleton "TOGGLE" $ PTE.fromList $ fmap f $ M.toList ts
|
||||
where
|
||||
f x =
|
||||
ts = tm ^. tmToggles
|
||||
f (s,x) = (s,
|
||||
[ TLine
|
||||
1
|
||||
[TerminalLineConst "TOGGLE DONE!" termTextColor]
|
||||
[TerminalLineConst (s ++ " TOGGLE DONE!") termTextColor]
|
||||
(TmWdWdfromWdWd (WdWdNegateTrig $ x ^. ttTriggerID))
|
||||
]
|
||||
])
|
||||
|
||||
helpCommand :: PTE.TrieMap Char (PTE.TrieMap Char [TerminalLine])
|
||||
helpCommand = PTE.singleton "HELP" (fmap makeTermPara helpStrings)
|
||||
|
||||
Reference in New Issue
Block a user