From a5587ade443cc5f4a9b1c62ddbf76f383d0a4389 Mon Sep 17 00:00:00 2001 From: melancholytron Date: Sun, 1 Mar 2026 12:45:41 -0600 Subject: [PATCH] Add auto-connect on Launch AR button press Reads server host/port from start screen inputs and auto-connects if not already connected when entering AR mode. Co-Authored-By: Claude Opus 4.6 --- Main.gd | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Main.gd b/Main.gd index 6094c71..bbf8591 100644 --- a/Main.gd +++ b/Main.gd @@ -257,6 +257,19 @@ func _on_launch_ar_requested() -> void: print("[Main] Launching AR mode") current_phase = Phase.AR + # Auto-connect if not already connected + if not teleop_client.is_connected: + var host: String = start_screen.host_input.text.strip_edges() + var port: int = int(start_screen.port_input.text.strip_edges()) + if host.is_empty(): + host = "10.0.0.77" + if port <= 0 or port > 65535: + port = 8765 + teleop_client.server_host = host + teleop_client.server_port = port + teleop_client.connect_to_server() + print("[Main] Auto-connecting to %s:%d" % [host, port]) + # Enable passthrough _enable_passthrough()