From 67820a291c75106aabf74de5c076c21cee1aab2a Mon Sep 17 00:00:00 2001 From: Jennie Robinson Faber Date: Sun, 17 May 2026 23:48:32 +0100 Subject: [PATCH] Free the robots --- scenes/world.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scenes/world.gd b/scenes/world.gd index 96c6ed7..6e46f2b 100644 --- a/scenes/world.gd +++ b/scenes/world.gd @@ -20,10 +20,10 @@ func _ready() -> void: _wall_display.modulate = WALL_DISPLAY_COLOR _wall_display.text = str(_current_floor) EventBus.doors_closed.connect(_on_doors_closed) - EventBus.doors_fully_closed.connect(_free_robot) + EventBus.doors_fully_closed.connect(_free_robot_unless_winning) EventBus.doors_opened.connect(_on_doors_opened) EventBus.floor_changed.connect(_on_floor_changed) - EventBus.game_lost.connect(func(_reason: String): _free_robot()) + EventBus.game_lost.connect(func(_reason: String): _free_robot_unless_winning()) EventBus.game_won.connect(_free_robot) func _collect_dim_targets() -> void: @@ -62,6 +62,11 @@ func _free_robot() -> void: _robot.queue_free() _robot = null +func _free_robot_unless_winning() -> void: + if is_instance_valid(_robot) and _robot.robot_win: + return + _free_robot() + func _on_floor_changed(new_floor: int) -> void: _current_floor = new_floor _wall_display.text = str(new_floor)