Add external Trie library before using Tries for terminal commands

This commit is contained in:
2025-08-16 01:58:21 +01:00
parent 73cdf42e4a
commit f7759b1f31
9 changed files with 15 additions and 12 deletions
+6 -5
View File
@@ -8,6 +8,7 @@ module Dodge.Data.Terminal (
module Dodge.Data.Terminal.Status,
) where
import qualified Data.ListTrie.Patricia.Map.Enum as PT
import Sound.Data
import Color
import Control.Lens
@@ -30,7 +31,7 @@ data Terminal = Terminal
, _tmExternalColor :: Color
, _tmDisplayedLines :: [(String, Color)]
, _tmFutureLines :: [TerminalLine]
, _tmScrollCommands :: [TerminalCommand]
, _tmCommands :: [TerminalCommand]
, _tmDeathEffect :: TmWdWd
, _tmStatus :: TerminalStatus
, _tmCommandHistory :: [String]
@@ -76,10 +77,10 @@ data TerminalCommand = TerminalCommand
, _tcEffect :: TerminalCommandEffect -- Terminal -> World -> EffectArguments
}
--data TCom = TCom
-- { _tcomHelp :: String
-- , _tcomArgs :: Trie Char [TerminalLine]
-- }
data TCom = TCom
{ _tcomHelp :: String
, _tcomArgs :: PT.TrieMap Char [TerminalLine]
}
data TmWdWd
= TmWdId
+1 -1
View File
@@ -17,7 +17,7 @@ defaultTerminal =
, _tmDisplayedLines = []
, _tmFutureLines = []
-- , _tmInput = defaultTerminalInput
, _tmScrollCommands = []
, _tmCommands = []
-- , _tmWriteCommands = []
, _tmDeathEffect = TmWdId
, _tmStatus = TerminalOff
+1 -1
View File
@@ -21,7 +21,7 @@ analyser proxreq pslight psmc = extTrigLitPos pslight $ \tp ->
(themachine & mcMounts . at OTTrigger .~ _plMID tp)
tparams -- (linksensortotrigger tp)
where
tparams = basicTerminal & tmScrollCommands .:~ sensorCommand
tparams = basicTerminal & tmCommands .:~ sensorCommand
-- linksensortotrigger tp _ mc
-- = triggers . ix (fromJust $ _plMID tp) .~ const (_sensToggle $ _mcSensor mc)
themachine =
+1 -1
View File
@@ -74,7 +74,7 @@ sensInsideDoor senseType outplid rm =
.++~ [ psPt atFstLnkOut . PutForeground $ floorWire (V2 20 0) (V2 20 (-100))
, psPt atFstLnkOut . PutForeground $ floorWire (V2 0 (-100)) (V2 20 (-100))
, psPt atFstLnkOut . PutForeground $ verticalWire (V2 20 0) 0 80
, putMessageTerminal terminalColor (basicTerminal & tmScrollCommands .:~ damageCodeCommand)
, putMessageTerminal terminalColor (basicTerminal & tmCommands .:~ damageCodeCommand)
& plSpot .~ rprBoolShift isUnusedLnk (shiftInBy 10)
]
& rmOutPmnt .~ [OutPlacement (sensAboveDoor senseType 10 (atFstLnkOutShiftInward 100)) outplid]
+1 -1
View File
@@ -47,7 +47,7 @@ addWarningTerminal str outplid =
)
termMessages trpl =
lineOutputTerminal (makeColorTermLine red "WARNING" : makeTermPara str)
& tmScrollCommands .:~ toggleCommand
& tmCommands .:~ toggleCommand
& tmToggles
.~ M.fromList
[("DOOR", TerminalToggle (fromJust $ _plMID trpl) (BlConst True))]
+2 -2
View File
@@ -40,7 +40,7 @@ basicTerminal =
{ _tmDisplayedLines = []
, _tmFutureLines = []
-- , _tmTitle = "TERMINAL"
, _tmScrollCommands = [helpCommand,commandsCommand,quitCommand]
, _tmCommands = [helpCommand,commandsCommand,quitCommand]
-- , _tmWriteCommands = [helpCommand, commandsCommand]
, _tmBootLines = connectionBlurb
, _tmDeathEffect = TmWdWdDoDeathTriggers
@@ -110,7 +110,7 @@ termTextColor :: Color
termTextColor = greyN 0.9
getCommands :: Terminal -> [TerminalCommand]
getCommands tm = _tmScrollCommands tm -- ++ _tmWriteCommands tm
getCommands tm = _tmCommands tm -- ++ _tmWriteCommands tm
makeTermLine :: String -> TerminalLine
makeTermLine = makeColorTermLine termTextColor
+1 -1
View File
@@ -79,7 +79,7 @@ lineOutputTerminal tls =
{ _tmDisplayedLines = []
, _tmFutureLines = []
-- , _tmTitle = "TERMINAL"
, _tmScrollCommands = [helpCommand,commandsCommand,quitCommand]
, _tmCommands = [helpCommand,commandsCommand,quitCommand]
-- , _tmWriteCommands = [helpCommand, commandsCommand]
, _tmBootLines = connectionBlurbLines tls
, _tmDeathEffect = TmWdWdDoDeathTriggers