Add external Trie library before using Tries for terminal commands
This commit is contained in:
@@ -54,6 +54,7 @@ dependencies:
|
||||
- tasty
|
||||
- tasty-hunit
|
||||
- tasty-quickcheck
|
||||
- list-tries
|
||||
|
||||
library:
|
||||
source-dirs: src
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@ defaultTerminal =
|
||||
, _tmDisplayedLines = []
|
||||
, _tmFutureLines = []
|
||||
-- , _tmInput = defaultTerminalInput
|
||||
, _tmScrollCommands = []
|
||||
, _tmCommands = []
|
||||
-- , _tmWriteCommands = []
|
||||
, _tmDeathEffect = TmWdId
|
||||
, _tmStatus = TerminalOff
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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))]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -42,6 +42,7 @@ packages:
|
||||
extra-deps:
|
||||
#- SDL-0.6.7.0@sha256:9d6ba75c0cab575ec38468c8277803983e985f9622437aeca6a53e6a7337a7d5,2045
|
||||
- sdl2-mixer-1.2.0.0@sha256:6a6b5a46c035c9e77eaf9c244e45de9e4a9b9a110890cfeeb9fa72faa2419cef,4497
|
||||
- list-tries-0.6.7.1@sha256:a53b4a466d2ecdb932da4c1d34ec8dda99d9eba2977eb991f6b052ad710e249d,4272
|
||||
#- repa-3.4.1.5@sha256:4d94845e66d668345130f75f5de8f7c69139b91495c8c4b5a825014e8985e2fd,3562
|
||||
#- strict-containers-0.1@sha256:d751696a8a74e368cf778cf98410b43fcd192d68febd4c691faaac1d6c3ab63f,10591
|
||||
#- strict-containers-lens-0.1@sha256:97c0e68e2e23578074d41fa45690a9ff7b1d47057ea6635d863af99f0daa2f9d,1103
|
||||
|
||||
Reference in New Issue
Block a user