From 5698d06485b0c5954ffc4e6e4499b40ed1979770 Mon Sep 17 00:00:00 2001 From: Michele Rossi Date: Fri, 10 Apr 2026 12:07:01 +0200 Subject: [PATCH] Fix flow --- core/level_game_state.gd | 3 + core/prestige/prestige_panel.gd | 11 +- core/prestige/prestige_progress_bar.gd | 10 +- currency_label.gd | 8 +- .../tiny_sword/buildings/castle/test_buff.gd | 30 ++-- docs/gyms/tiny_sword/tiny_sword.tscn | 54 +++---- goals_debug_ui.gd | 150 ++++-------------- 7 files changed, 92 insertions(+), 174 deletions(-) diff --git a/core/level_game_state.gd b/core/level_game_state.gd index 45cb5f8..46fc473 100644 --- a/core/level_game_state.gd +++ b/core/level_game_state.gd @@ -67,7 +67,10 @@ const TOTAL_KEY: String = "total" const ALL_TIME_KEY: String = "all_time" const LAST_SAVE_TIME_KEY: String = "last_save_time" +var prestige_manager: PrestigeManager + func _ready() -> void: + prestige_manager = find_child("PrestigeManager") _initialize_currency_maps() _initialize_catalogues() _load_catalogue_goals() diff --git a/core/prestige/prestige_panel.gd b/core/prestige/prestige_panel.gd index 83353c1..cec0c33 100644 --- a/core/prestige/prestige_panel.gd +++ b/core/prestige/prestige_panel.gd @@ -1,8 +1,6 @@ class_name PrestigePanel extends PanelContainer -@export var game_state: LevelGameState - @onready var _total_value: Label = $MarginContainer/VBoxContainer/StatsGrid/TotalValue @onready var _pending_value: Label = $MarginContainer/VBoxContainer/StatsGrid/PendingValue @onready var _multiplier_value: Label = $MarginContainer/VBoxContainer/StatsGrid/MultiplierValue @@ -11,6 +9,7 @@ extends PanelContainer @onready var _reset_button: Button = $MarginContainer/VBoxContainer/Buttons/ResetButton @onready var _save_button: Button = $MarginContainer/VBoxContainer/Buttons/SaveButton @onready var _confirm_dialog: ConfirmationDialog = $ConfirmDialog +@onready var game_state: LevelGameState = find_parent("LevelGameState") var _is_waiting_for_confirm: bool = false @@ -62,11 +61,11 @@ func _on_confirm_dialog_confirmed() -> void: return _is_waiting_for_confirm = false - var manager: Node = _get_prestige_manager() + var manager: PrestigeManager = _get_prestige_manager() if manager == null: return - manager.call("perform_prestige") + manager.perform_prestige() func _on_confirm_dialog_canceled() -> void: _is_waiting_for_confirm = false @@ -90,5 +89,5 @@ func _refresh_ui() -> void: _basis_label.text = "%s (%s)" % [basis_text, basis_value.to_string_suffix(2)] _reset_button.disabled = not bool(manager.call("can_prestige")) -func _get_prestige_manager() -> Node: - return get_node_or_null("/root/PrestigeManager") +func _get_prestige_manager() -> PrestigeManager: + return game_state.prestige_manager diff --git a/core/prestige/prestige_progress_bar.gd b/core/prestige/prestige_progress_bar.gd index b1bcbd6..adee1db 100644 --- a/core/prestige/prestige_progress_bar.gd +++ b/core/prestige/prestige_progress_bar.gd @@ -8,11 +8,17 @@ extends HBoxContainer var _basis_value: BigNumber var _next_threshold: BigNumber -var _manager: Node var _connected: bool = false +var _game_state: LevelGameState +var _manager: PrestigeManager func _ready() -> void: - _manager = get_node_or_null("/root/PrestigeManager") + _game_state = find_parent("LevelGameState") + _game_state.ready.connect(_on_game_state_ready) + +func _on_game_state_ready() -> void: + _manager = _game_state.prestige_manager + if _manager == null: push_warning("PrestigeProgressBar '%s' cannot find PrestigeManager; progress bar disabled." % String(name)) visible = false diff --git a/currency_label.gd b/currency_label.gd index 91b99bc..53d0115 100644 --- a/currency_label.gd +++ b/currency_label.gd @@ -20,10 +20,14 @@ func _ready() -> void: push_error("CurrencyTile '%s' missing game_state reference" % String(name)) return + game_state.ready.connect(_on_level_game_state_ready) + +func _on_level_game_state_ready() -> void: + var label_string = game_state.get_currency_name(_currency_id) _currency_id = game_state.get_currency_id(currency) - _label.text = "%s:" % game_state.get_currency_name(_currency_id) + _label.text = "%s:" % label_string _icon.texture = game_state.get_currency_icon(_currency_id) - _debug_button.text = "+100 %s" % game_state.get_currency_name(_currency_id) + _debug_button.text = "+100 %s" % label_string game_state.currency_changed.connect(_on_currency_changed) _on_currency_changed(_currency_id, game_state.get_currency_amount_by_id(_currency_id)) diff --git a/docs/gyms/tiny_sword/buildings/castle/test_buff.gd b/docs/gyms/tiny_sword/buildings/castle/test_buff.gd index 05b8382..a83233a 100644 --- a/docs/gyms/tiny_sword/buildings/castle/test_buff.gd +++ b/docs/gyms/tiny_sword/buildings/castle/test_buff.gd @@ -1,8 +1,8 @@ extends PanelContainer @export var buff_data: GeneratorBuffData -@export var game_state: LevelGameState +@onready var _game_state: LevelGameState = find_parent("LevelGameState") @onready var _label: Label = $HBoxContainer/Label @onready var _button: Button = $HBoxContainer/Button @@ -20,10 +20,10 @@ func _ready() -> void: _button.disabled = true _button.pressed.connect(_on_button_pressed) - if game_state: - game_state.buff_level_changed.connect(_on_buff_level_changed) - game_state.buff_unlocked_changed.connect(_on_buff_unlocked_changed) - game_state.currency_changed.connect(_on_currency_changed) + if _game_state: + _game_state.buff_level_changed.connect(_on_buff_level_changed) + _game_state.buff_unlocked_changed.connect(_on_buff_unlocked_changed) + _game_state.currency_changed.connect(_on_currency_changed) _update_ui() @@ -37,9 +37,9 @@ func _on_button_pressed() -> void: return var cost: BigNumber = buff_data.get_cost_for_level(_current_level) - if game_state and game_state.spend_currency_by_id(cost_currency_id, cost): + if _game_state and _game_state.spend_currency_by_id(cost_currency_id, cost): var next_level: int = _current_level + 1 - game_state.set_buff_level(buff_data.id, next_level) + _game_state.set_buff_level(buff_data.id, next_level) _apply_buff_effect(buff_data, next_level) _current_level = next_level _update_ui() @@ -56,17 +56,17 @@ func _apply_buff_effect(buff: GeneratorBuffData, level: int) -> void: return var purchased_amount: BigNumber = buff.get_resource_purchase_amount_for_level(level) - if purchased_amount.mantissa > 0.0 and game_state: - game_state.add_currency_by_id(target_currency_id, purchased_amount) + if purchased_amount.mantissa > 0.0 and _game_state: + _game_state.add_currency_by_id(target_currency_id, purchased_amount) func _resolve_buff_target_currency_id(buff: GeneratorBuffData) -> StringName: if buff.resource_target_currency == null: return &"" - if game_state == null: + if _game_state == null: return &"" - return game_state.get_currency_id(buff.resource_target_currency) + return _game_state.get_currency_id(buff.resource_target_currency) func _on_buff_level_changed(buff_id: StringName, new_level: int) -> void: @@ -86,7 +86,7 @@ func _update_ui() -> void: if buff_data == null: return - if game_state and not game_state.is_buff_unlocked(buff_data.id): + if _game_state and not _game_state.is_buff_unlocked(buff_data.id): _button.disabled = true _button.text = "Locked" return @@ -97,7 +97,7 @@ func _update_ui() -> void: var cost_currency_id: StringName = _resolve_buff_cost_currency_id(buff_data) if cost_currency_id != &"": var cost: BigNumber = buff_data.get_cost_for_level(_current_level) - var current_amount: BigNumber = game_state.get_currency_amount_by_id(cost_currency_id) if game_state else BigNumber.from_float(0.0) + var current_amount: BigNumber = _game_state.get_currency_amount_by_id(cost_currency_id) if _game_state else BigNumber.from_float(0.0) can_buy = can_buy and (current_amount.is_greater_than(cost) or current_amount.is_equal_to(cost)) _button.disabled = not can_buy @@ -113,6 +113,6 @@ func _resolve_buff_cost_currency_id(buff: GeneratorBuffData) -> StringName: if buff.cost_currency == null: return &"" - if game_state == null: + if _game_state == null: return &"" - return game_state.get_currency_id(buff.cost_currency) + return _game_state.get_currency_id(buff.cost_currency) diff --git a/docs/gyms/tiny_sword/tiny_sword.tscn b/docs/gyms/tiny_sword/tiny_sword.tscn index 41532c1..03923d1 100644 --- a/docs/gyms/tiny_sword/tiny_sword.tscn +++ b/docs/gyms/tiny_sword/tiny_sword.tscn @@ -32,92 +32,92 @@ script = ExtResource("5_x77df") config = ExtResource("6_xnhlc") game_state = NodePath("..") -[node name="World" type="Node2D" parent="." unique_id=2118297724] +[node name="World" type="Node2D" parent="LevelGameState" unique_id=2118297724] -[node name="ForestProps" type="Node2D" parent="World" unique_id=649424542] +[node name="ForestProps" type="Node2D" parent="LevelGameState/World" unique_id=649424542] -[node name="Tree1" parent="World/ForestProps" unique_id=1917119095 instance=ExtResource("14_0cs5o")] +[node name="Tree1" parent="LevelGameState/World/ForestProps" unique_id=1917119095 instance=ExtResource("14_0cs5o")] position = Vector2(1486, 543) -[node name="Tree2" parent="World/ForestProps" unique_id=1429193881 instance=ExtResource("14_0cs5o")] +[node name="Tree2" parent="LevelGameState/World/ForestProps" unique_id=1429193881 instance=ExtResource("14_0cs5o")] position = Vector2(1510, 586) -[node name="Tree3" parent="World/ForestProps" unique_id=856028883 instance=ExtResource("14_0cs5o")] +[node name="Tree3" parent="LevelGameState/World/ForestProps" unique_id=856028883 instance=ExtResource("14_0cs5o")] position = Vector2(1600, 586) -[node name="Tree4" parent="World/ForestProps" unique_id=547138642 instance=ExtResource("14_0cs5o")] +[node name="Tree4" parent="LevelGameState/World/ForestProps" unique_id=547138642 instance=ExtResource("14_0cs5o")] position = Vector2(1482, 655) -[node name="Tree5" parent="World/ForestProps" unique_id=660535343 instance=ExtResource("14_0cs5o")] +[node name="Tree5" parent="LevelGameState/World/ForestProps" unique_id=660535343 instance=ExtResource("14_0cs5o")] position = Vector2(1568, 656) -[node name="Tree6" parent="World/ForestProps" unique_id=894701042 instance=ExtResource("14_0cs5o")] +[node name="Tree6" parent="LevelGameState/World/ForestProps" unique_id=894701042 instance=ExtResource("14_0cs5o")] position = Vector2(1665, 650) -[node name="Tree7" parent="World/ForestProps" unique_id=1661458508 instance=ExtResource("14_0cs5o")] +[node name="Tree7" parent="LevelGameState/World/ForestProps" unique_id=1661458508 instance=ExtResource("14_0cs5o")] position = Vector2(1362, 792) -[node name="Tree8" parent="World/ForestProps" unique_id=2029836975 instance=ExtResource("14_0cs5o")] +[node name="Tree8" parent="LevelGameState/World/ForestProps" unique_id=2029836975 instance=ExtResource("14_0cs5o")] position = Vector2(1452, 790) -[node name="Tree9" parent="World/ForestProps" unique_id=1580665442 instance=ExtResource("14_0cs5o")] +[node name="Tree9" parent="LevelGameState/World/ForestProps" unique_id=1580665442 instance=ExtResource("14_0cs5o")] position = Vector2(1557, 793) -[node name="Tree10" parent="World/ForestProps" unique_id=1295721315 instance=ExtResource("14_0cs5o")] +[node name="Tree10" parent="LevelGameState/World/ForestProps" unique_id=1295721315 instance=ExtResource("14_0cs5o")] position = Vector2(1644, 822) -[node name="GoldMine" parent="World" unique_id=341660167 instance=ExtResource("2_2j2oc")] +[node name="GoldMine" parent="LevelGameState/World" unique_id=341660167 instance=ExtResource("2_2j2oc")] position = Vector2(274, 429) -[node name="Castle" parent="World" unique_id=1966557957 instance=ExtResource("3_5ru58")] +[node name="Castle" parent="LevelGameState/World" unique_id=1966557957 instance=ExtResource("3_5ru58")] position = Vector2(853, 357) -[node name="Farm" parent="World" unique_id=283335851 instance=ExtResource("10_1lv5i")] +[node name="Farm" parent="LevelGameState/World" unique_id=283335851 instance=ExtResource("10_1lv5i")] position = Vector2(380, 684) -[node name="Forestry" parent="World" unique_id=726284577 instance=ExtResource("11_pyqyw")] +[node name="Forestry" parent="LevelGameState/World" unique_id=726284577 instance=ExtResource("11_pyqyw")] position = Vector2(825, 915) -[node name="UI" type="Control" parent="." unique_id=1299828389] +[node name="UI" type="Control" parent="LevelGameState" unique_id=1299828389] layout_mode = 3 anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 -[node name="GoldCurrencyTile" parent="UI" unique_id=1440583137 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] +[node name="GoldCurrencyTile" parent="LevelGameState/UI" unique_id=1440583137 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] layout_mode = 0 offset_right = 160.0 offset_bottom = 31.0 currency = ExtResource("9_1363k") -game_state = NodePath("../../LevelGameState") +game_state = NodePath("../..") -[node name="WorkerCurrencyTile" parent="UI" unique_id=1164876942 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] +[node name="WorkerCurrencyTile" parent="LevelGameState/UI" unique_id=1164876942 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] layout_mode = 0 offset_top = 32.0 offset_right = 160.0 offset_bottom = 63.0 currency = ExtResource("10_i1cck") -game_state = NodePath("../../LevelGameState") +game_state = NodePath("../..") -[node name="FoodCurrencyTile" parent="UI" unique_id=1814936562 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] +[node name="FoodCurrencyTile" parent="LevelGameState/UI" unique_id=1814936562 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] layout_mode = 0 offset_top = 63.0 offset_right = 160.0 offset_bottom = 94.0 currency = ExtResource("11_hskcg") -game_state = NodePath("../../LevelGameState") +game_state = NodePath("../..") -[node name="WoodCurrencyTile" parent="UI" unique_id=338003163 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] +[node name="WoodCurrencyTile" parent="LevelGameState/UI" unique_id=338003163 node_paths=PackedStringArray("game_state") instance=ExtResource("7_0cs5o")] layout_mode = 0 offset_top = 94.0 offset_right = 160.0 offset_bottom = 125.0 currency = ExtResource("12_l6a68") -game_state = NodePath("../../LevelGameState") +game_state = NodePath("../..") -[node name="GoalsDebugUI" parent="UI" unique_id=1494700185 instance=ExtResource("10_qifrv")] +[node name="GoalsDebugUI" parent="LevelGameState/UI" unique_id=1494700185 instance=ExtResource("10_qifrv")] layout_mode = 1 -offset_left = 1253.0 +offset_left = 1067.0 offset_top = 817.0 offset_right = 1913.0 offset_bottom = 1076.0 diff --git a/goals_debug_ui.gd b/goals_debug_ui.gd index 7d97513..a048155 100644 --- a/goals_debug_ui.gd +++ b/goals_debug_ui.gd @@ -1,11 +1,9 @@ extends PanelContainer class GoalDefinition extends RefCounted: - var target_generator_id: StringName var goal: GoalData - func _init(target_id: StringName, goal_data: GoalData) -> void: - target_generator_id = target_id + func _init(goal_data: GoalData) -> void: goal = goal_data const GOAL_DATA_SCRIPT: Script = preload("res://core/goals/goal_data.gd") @@ -29,18 +27,19 @@ class GoalRow extends RefCounted: var _loaded_goals: Array[GoalDefinition] = [] var _rows_by_goal_id: Dictionary = {} -var _known_generator_ids: Dictionary = {} -var _warned_unknown_target_ids: Dictionary = {} -var _generators_by_id: Dictionary = {} func _ready() -> void: - _collect_known_generator_ids() - _load_goals() - _build_goal_rows() if game_state: game_state.currency_changed.connect(_on_currency_changed) game_state.generator_state_changed.connect(_on_generator_state_changed) game_state.goal_completed.connect(_on_goal_completed) + + if not game_state.get_all_goals().is_empty(): + _load_goals() + _build_goal_rows() + else: + game_state.ready.connect(_on_level_state_ready) + _refresh_ui() _refresh_ui.call_deferred() @@ -50,33 +49,20 @@ func _on_currency_changed(_currency_id: StringName, _new_amount: BigNumber) -> v func _on_goal_completed(goal_id: StringName) -> void: _refresh_ui() -func _on_generator_state_changed(generator_id: StringName, _state: Dictionary) -> void: - var generator_key: String = String(generator_id) - if not generator_key.is_empty(): - _known_generator_ids[generator_key] = true - _refresh_generator_lookup(generator_id) +func _on_generator_state_changed(_generator_id: StringName, _state: Dictionary) -> void: + _refresh_ui() + +func _on_level_state_ready() -> void: + _load_goals() + _build_goal_rows() _refresh_ui() func _load_goals() -> void: _loaded_goals.clear() - _generators_by_id.clear() - var scene_root: Node = get_tree().current_scene - var search_root: Node = scene_root if scene_root != null else self - var generator_nodes: Array[Node] = search_root.find_children("*", "CurrencyGenerator", true, false) - - for generator_node in generator_nodes: - var generator: CurrencyGenerator = generator_node as CurrencyGenerator - if generator == null: - continue - - var generator_id: StringName = generator.get_generator_id() - if generator_id == &"": - continue - _generators_by_id[String(generator_id)] = generator - - var seen_goal_ids: Dictionary = {} var all_goals_raw: Array = game_state.get_all_goals() if game_state else [] + var seen_goal_ids: Dictionary = {} + for goal_raw in all_goals_raw: var goal: GoalData = goal_raw as GoalData if goal == null or not goal.has_id(): @@ -86,12 +72,8 @@ func _load_goals() -> void: if seen_goal_ids.has(goal_key): continue - var target_generator_id: StringName = _find_generator_for_goal(goal) - if target_generator_id.is_empty(): - continue - seen_goal_ids[goal_key] = true - _loaded_goals.append(GoalDefinition.new(target_generator_id, goal)) + _loaded_goals.append(GoalDefinition.new(goal)) func _build_goal_rows() -> void: _rows_by_goal_id.clear() @@ -108,7 +90,7 @@ func _build_goal_rows() -> void: var title_label: Label = Label.new() title_label.custom_minimum_size = Vector2(220.0, 0.0) - title_label.text = "%s -> %s" % [String(goal.goal.id), String(goal.target_generator_id)] + title_label.text = String(goal.goal.id) var status_label: Label = Label.new() status_label.custom_minimum_size = Vector2(95.0, 0.0) @@ -122,10 +104,10 @@ func _build_goal_rows() -> void: unlock_button.disabled = true unlock_button.pressed.connect(_on_unlock_pressed.bind(goal.goal.id)) + row_container.add_child(unlock_button) row_container.add_child(title_label) row_container.add_child(status_label) row_container.add_child(requirements_label) - row_container.add_child(unlock_button) _goals_list.add_child(row_container) _rows_by_goal_id[String(goal.goal.id)] = GoalRow.new(goal, status_label, requirements_label, unlock_button) @@ -156,9 +138,8 @@ func _refresh_ui() -> void: func _refresh_goal_row(row: GoalRow) -> void: var goal: GoalDefinition = row.goal var already_unlocked: bool = _is_goal_completed(goal) - var can_resolve_target: bool = _can_resolve_target(goal.target_generator_id) var met: bool = _is_goal_met(goal) - var can_click: bool = can_resolve_target and met and not already_unlocked + var can_click: bool = met and not already_unlocked row.requirements_label.text = _get_requirements_text(goal) row.button.disabled = not can_click @@ -171,10 +152,6 @@ func _refresh_goal_row(row: GoalRow) -> void: row.status_label.text = "Unlocked" return - if not can_resolve_target: - row.status_label.text = "Missing" - return - if met: row.status_label.text = "Ready" return @@ -206,96 +183,18 @@ func _on_unlock_pressed(goal_id: StringName) -> void: var goal: GoalDefinition = row.goal if _is_goal_completed(goal): return - if not _can_resolve_target(goal.target_generator_id): - return if not _is_goal_met(goal): return if game_state == null: return - var generator: CurrencyGenerator = _get_generator_for_goal(goal) - if generator == null: - return - - game_state.set_generator_unlocked(goal.target_generator_id, true) - game_state.set_generator_available(goal.target_generator_id, true) if goal.goal.unlock_behavior == GoalData.UnlockBehavior.MANUAL: game_state._complete_goal_manually(goal.goal.id) - print("[GoalsDebugUI] Unlocked goal '%s' -> %s" % [String(goal.goal.id), String(goal.target_generator_id)]) + print("[GoalsDebugUI] Unlocked goal '%s'" % String(goal.goal.id)) _refresh_ui() -func _can_resolve_target(target_generator_id: StringName) -> bool: - var target_key: String = String(target_generator_id) - if target_key.is_empty(): - return false - - if _known_generator_ids.has(target_key) or (game_state and game_state.generator_states.has(target_key)): - return true - - if not _warned_unknown_target_ids.has(target_key): - _warned_unknown_target_ids[target_key] = true - push_warning("Goals debug UI target generator not found in scene/state: '%s'" % target_key) - return false - -func _collect_known_generator_ids() -> void: - _known_generator_ids.clear() - _generators_by_id.clear() - - var scene_root: Node = get_tree().current_scene - var search_root: Node = scene_root if scene_root != null else self - var generator_nodes: Array[Node] = search_root.find_children("*", "CurrencyGenerator", true, false) - for generator_node in generator_nodes: - var generator: CurrencyGenerator = generator_node as CurrencyGenerator - if generator == null: - continue - - var generator_key: String = String(generator.get_generator_id()) - if generator_key.is_empty(): - continue - - _known_generator_ids[generator_key] = true - _generators_by_id[generator_key] = generator - -func _refresh_generator_lookup(generator_id: StringName) -> void: - var generator_key: String = String(generator_id) - if generator_key.is_empty(): - return - - var scene_root: Node = get_tree().current_scene - var search_root: Node = scene_root if scene_root != null else self - var generator_nodes: Array[Node] = search_root.find_children("*", "CurrencyGenerator", true, false) - for generator_node in generator_nodes: - var generator: CurrencyGenerator = generator_node as CurrencyGenerator - if generator == null: - continue - if generator.get_generator_id() != generator_id: - continue - - _generators_by_id[generator_key] = generator - return - -func _get_generator_for_goal(goal: GoalDefinition) -> CurrencyGenerator: - if goal == null: - return null - - var key: String = String(goal.target_generator_id) - if key.is_empty(): - return null - - return _generators_by_id.get(key) as CurrencyGenerator - -func _find_generator_for_goal(goal: GoalData) -> StringName: - for generator_id in _generators_by_id.keys(): - var generator: CurrencyGenerator = _generators_by_id[generator_id] - if generator == null or generator.data == null: - continue - if generator.data.has_unlock_goal(): - if String(generator.data.get_unlock_goal_id()) == String(goal.id): - return StringName(generator_id) - return &"" - func _get_requirements_text(goal: GoalDefinition) -> String: if goal == null: return "" @@ -336,3 +235,10 @@ func _currency_label(currency_id: StringName) -> String: if game_state == null: return "Unknown" return game_state.get_currency_name(currency_id) + +func _exit_tree() -> void: + if game_state: + game_state.currency_changed.disconnect(_on_currency_changed) + game_state.generator_state_changed.disconnect(_on_generator_state_changed) + game_state.goal_completed.disconnect(_on_goal_completed) + game_state.ready.disconnect(_on_level_state_ready)