extends Node const DIALOGUE := preload("res://scripts/core/dialogue_overlay.gd") var probe := false func _ready() -> void: if probe: return var watcher := Node.new() watcher.set_script(get_script()) watcher.probe = true watcher.process_mode = Node.PROCESS_MODE_ALWAYS get_tree().root.add_child.call_deferred(watcher) watcher.call_deferred("run") func frames(count: int) -> void: for i: int in count: await get_tree().process_frame func read_all() -> Array[String]: var scenes: Array[String] = [] for i: int in 300: if DIALOGUE.current != null: var id := str(DIALOGUE.current.scene_id) if scenes.is_empty() or scenes.back() != id: scenes.append(id) DIALOGUE.current.story.auto_advance = true await frames(1) return scenes func run() -> void: await frames(4) GameState.save_locked = true GameState.story_triggers.enabled = false GameState._reset_progress_state() GameState.set_scoped_value("meta", "dimension_index", 3) GameState.set_scoped_value("run", "debug_arrival_room", "d4_l30_wec_lobby") get_tree().change_scene_to_file("res://scenes/dungeon/dungeon.tscn") await frames(8) var dungeon := get_tree().current_scene var boss: Enemy for enemy: Node in GameState.scoped_nodes(dungeon, "enemy"): if enemy is Enemy: enemy.set_physics_process(false) if enemy.enemy_id == "big_egg_four": boss = enemy if boss == null: push_error("PHASE PROBE: missing boss") get_tree().quit(2) return dungeon.combat_presentation.set_script(load("res://tools/dev/runs/ligne96-work/phase_director.gd")) dungeon.combat_presentation.reset() dungeon.combat_presentation.enabled = true boss.health = boss.max_health * 0.4 boss._run_ability_triggers("health_below", boss.max_health) var scenes := await read_all() print("PHASE ORDER: ", scenes) var okay := scenes == ["big_egg_four_slop_machine", "slop_machine_combat_intro"] if not okay: push_error("PHASE PROBE: flee narrative must precede machine introduction") Input.set_custom_mouse_cursor(null) get_tree().paused = false get_tree().change_scene_to_file("res://scenes/main/main_menu.tscn") await frames(8) AudioDirector.shutdown() get_tree().quit(0 if okay else 1)