From a04d7699ae9dc703d94c39dd076e832b036cf32e Mon Sep 17 00:00:00 2001 From: CT1138 Date: Wed, 25 Mar 2026 08:28:49 -0700 Subject: [PATCH] Wrote some connections between the shock/alarm buttons and the terminal --- Levels/test.tscn | 3 +++ Scripts/Gameplay/CommandLine/cCommandLine.gd | 16 ++++++++++------ map.png.import | 6 +++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Levels/test.tscn b/Levels/test.tscn index 858a011..15cd905 100644 --- a/Levels/test.tscn +++ b/Levels/test.tscn @@ -87,3 +87,6 @@ offset_bottom = 1542.0 scale = Vector2(0.29, 0.29) pivot_offset = Vector2(-39.952454, -39.952393) texture = ExtResource("4_afen0") + +[connection signal="button_down" from="B_Shock" to="CommandPrompt" method="_button_shock"] +[connection signal="button_down" from="B_Alarm" to="CommandPrompt" method="_button_alarm"] diff --git a/Scripts/Gameplay/CommandLine/cCommandLine.gd b/Scripts/Gameplay/CommandLine/cCommandLine.gd index 2ccff4b..bf2217a 100644 --- a/Scripts/Gameplay/CommandLine/cCommandLine.gd +++ b/Scripts/Gameplay/CommandLine/cCommandLine.gd @@ -8,12 +8,12 @@ var commands_directory = DirAccess.open("res://Scripts/Gameplay/CommandLine/Comm var commands: Dictionary = {} func _ready(): - load_commands() + _load_commands() input_line.text_submitted.connect(self._on_command_entered) # To make a new command, write it in ./Commands with a main() function for entry. # This function will automatically find and register all command files -func load_commands(): +func _load_commands(): if not commands_directory: push_error("Failed to open commands folder!") return @@ -37,7 +37,6 @@ func _on_command_entered(new_text: String) -> void: input_line.clear() _print("> " + new_text) - # Store command and ensure its not empty var parts = new_text.strip_edges().split(" ") if parts.size() == 0: return @@ -47,12 +46,17 @@ func _on_command_entered(new_text: String) -> void: var args = parts.slice(1, parts.size()) if commands.has(cmd): - var cmd_script = commands[cmd].new() # Instantiate the script + var cmd_script = commands[cmd].new() if cmd_script.has_method("main"): - # Run script cmd_script.main(args, self) else: _print("DEV ERROR !\nCommand '%s' has no main() function!" % cmd) else: _print("Unknown command: %s" % cmd) - input_line.text = "" # Clear input + input_line.clear() + +func _button_shock(): + _print("Shocked") + +func _button_alarm(): + _print("Alarm Triggered") diff --git a/map.png.import b/map.png.import index beafe35..027e6e8 100644 --- a/map.png.import +++ b/map.png.import @@ -3,11 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://cv2cadqcahubl" -valid=false +path="res://.godot/imported/map.png-9eea34967fae34f4388f4a32a16da936.ctex" +metadata={ +"vram_texture": false +} [deps] source_file="res://map.png" +dest_files=["res://.godot/imported/map.png-9eea34967fae34f4388f4a32a16da936.ctex"] [params]