From edc545bef9275391ef204f9dedb571f20a232d5d Mon Sep 17 00:00:00 2001 From: Brazly Date: Fri, 16 Jan 2026 03:54:29 +0000 Subject: [PATCH] added basic help command --- .../Scripts/UI/terminal/terminal_controls.gd | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/UI/terminal/terminal_controls.gd b/Assets/Scripts/UI/terminal/terminal_controls.gd index 3453175..4866d55 100644 --- a/Assets/Scripts/UI/terminal/terminal_controls.gd +++ b/Assets/Scripts/UI/terminal/terminal_controls.gd @@ -13,7 +13,7 @@ var fileSystem: Dictionary = { "special": { "notes.txt": "test", "secrets": { - "password.txt": 123 + "password.txt": "123" } } }, @@ -26,6 +26,7 @@ func _ready() -> void: terminalLine.text = "user@work "+ directory + " " UpdateCaretPos() blink_timer.start() + Help() # --- Caret Blinking Logic --- func _on_caret_timer_timeout() -> void: @@ -94,6 +95,10 @@ func EnterCommand() -> void: for child in historyContainer.get_children(): if child != terminalLine: child.queue_free() + "help": + + Help() + "": pass _: @@ -181,7 +186,24 @@ func RetrieveData(inputPath: String): CreateHistoryEntry(str(content)) else: CreateHistoryEntry("cat: " + targetFileName + ": No such file or directory") - + +func Help(commandName: String = "default"): + for child in historyContainer.get_children(): + if child != terminalLine: + child.queue_free() + match commandName: + "default": CreateHistoryEntry("--- AVAILABLE COMMANDS --- +ls (or list) [folder] : List all files and directories/folders +cd [folder] : Change directory (use '..' to go up a directory/folder) +cat (or view) [file] : Read the contents of a file +clear (or cls) : Clear the terminal screen +help : Show this menu +-------------------------") + + + + + func UpdateCaretPos(): var last_char_index = terminalLine.text.length() - 1 var char_rect = terminalLine.get_character_bounds(max(0, last_char_index))