From 712ce6e08219b28e1a686d6d39a8fbf2da07f8ae Mon Sep 17 00:00:00 2001 From: nitin gupta Date: Thu, 5 Feb 2026 13:00:26 +0530 Subject: [PATCH] feat: disable START button until route is connected --- Scripts/SinkClick.gd | 5 +++++ Scripts/event_button.gd | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Scripts/SinkClick.gd b/Scripts/SinkClick.gd index 6e5204a..5149870 100644 --- a/Scripts/SinkClick.gd +++ b/Scripts/SinkClick.gd @@ -8,6 +8,11 @@ func on_click(): print("hey") ConveyerController.destination.append(get_parent().get_position()) transfer_box() + + # Enable START button now that a route is connected + var start_button = get_tree().get_root().find_child("Control", true, false) + if start_button and start_button.has_method("enable_start"): + start_button.enable_start() func transfer_box(): print("sending") diff --git a/Scripts/event_button.gd b/Scripts/event_button.gd index 37fba59..cd5baec 100644 --- a/Scripts/event_button.gd +++ b/Scripts/event_button.gd @@ -1,15 +1,22 @@ extends Control +@onready var button = $Button # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. + # Disable START button initially - needs route to be connected first + button.disabled = true + button.modulate = Color(0.5, 0.5, 0.5, 1.0) # Gray out when disabled # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass +# Called by SinkClick when a route is connected +func enable_start() -> void: + button.disabled = false + button.modulate = Color(1.0, 1.0, 1.0, 1.0) # Normal color when enabled func _on_button_pressed() -> void: Level.initialise()