Rename help text-> footer text, rename tractor param
This commit is contained in:
+23
-23
@@ -1,20 +1,20 @@
|
||||
module Dodge.Debug.Terminal
|
||||
where
|
||||
import Dodge.Creature
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.YourControl
|
||||
import Dodge.Data
|
||||
import Dodge.Creature
|
||||
import Dodge.Creature.State
|
||||
import Dodge.Creature.YourControl
|
||||
import Dodge.Data
|
||||
import Dodge.Menu.PushPop
|
||||
import Control.Monad
|
||||
|
||||
import Control.Lens
|
||||
import Control.Lens
|
||||
import Text.Read (readMaybe)
|
||||
import Data.List (isPrefixOf, isInfixOf, intercalate)
|
||||
import Data.List --(isPrefixOf, isInfixOf, intercalate)
|
||||
import Data.Maybe (fromJust)
|
||||
import LensHelp
|
||||
import qualified Debug.Trace
|
||||
import Graphics.Rendering.OpenGL.GL.Shaders (validateProgram)
|
||||
import Dodge.Data (Universe(Universe))
|
||||
--import qualified Debug.Trace
|
||||
--import Graphics.Rendering.OpenGL.GL.Shaders (validateProgram)
|
||||
--import Dodge.Data (Universe(Universe))
|
||||
|
||||
applyTerminalString :: String -> Universe -> Universe
|
||||
applyTerminalString "NOCLIP" = config . debug_noclip %~ not
|
||||
@@ -64,21 +64,22 @@ applySetTerminalString var = case key' of
|
||||
key' = if val' == Nothing then "" else key
|
||||
|
||||
autoCompleteTerminal :: String -> String -> Universe -> IO (Maybe Universe)
|
||||
autoCompleteTerminal s help = return . (popScreen' >=> pushScreen' (InputScreen input_str valid_commands))
|
||||
where
|
||||
(key, val) = getSplitString $ tail s
|
||||
command_options = case val of
|
||||
"" -> filter (isInfixOf key) (validTerminalCommands "")
|
||||
_ -> filter (isInfixOf val) (validTerminalCommands key)
|
||||
-- basic autocomplete if single option available (or as far as possible)
|
||||
input_str = case (key, val) of
|
||||
(_, "") -> if length command_options == 1 then ">" ++ head command_options ++ " " else ">" ++ longestCommonPrefix command_options
|
||||
_ -> if length command_options == 1 then ">" ++ key ++ " " ++ head command_options ++ " " else if null command_options then s else ">" ++ key ++ " " ++ longestCommonPrefix command_options
|
||||
autoCompleteTerminal s _ = return .
|
||||
(popScreen' >=> pushScreen' (InputScreen input_str valid_commands))
|
||||
where
|
||||
(key, val) = getSplitString $ tail s
|
||||
command_options = case val of
|
||||
"" -> filter (isInfixOf key) (validTerminalCommands "")
|
||||
_ -> filter (isInfixOf val) (validTerminalCommands key)
|
||||
-- basic autocomplete if single option available (or as far as possible)
|
||||
input_str = case (key, val) of
|
||||
(_, "") -> if length command_options == 1 then ">" ++ head command_options ++ " " else ">" ++ longestCommonPrefix command_options
|
||||
_ -> if length command_options == 1 then ">" ++ key ++ " " ++ head command_options ++ " " else if null command_options then s else ">" ++ key ++ " " ++ longestCommonPrefix command_options
|
||||
|
||||
command_options' = if length command_options > 0 && head command_options == key then validTerminalCommands key else command_options
|
||||
command_options' = if length command_options > 0 && head command_options == key then validTerminalCommands key else command_options
|
||||
|
||||
--val' = Debug.Trace.trace key tail val
|
||||
valid_commands = "Options: " ++ intercalate ", " command_options'
|
||||
--val' = Debug.Trace.trace key tail val
|
||||
valid_commands = "Options: " ++ intercalate ", " command_options'
|
||||
|
||||
getSplitString :: [Char] -> ([Char], [Char])
|
||||
getSplitString str = case break (==' ') str of
|
||||
@@ -98,7 +99,6 @@ validTerminalCommands "set" = ["hp", "invcap", "invsel", "mass", "mvspeed"]
|
||||
validTerminalCommands "god" = ["on", "off"]
|
||||
validTerminalCommands _ = ["set", "spawn", "god"]
|
||||
|
||||
|
||||
loadme :: a
|
||||
loadme = undefined
|
||||
|
||||
|
||||
Reference in New Issue
Block a user