[gd_scene load_steps=3 format=3 uid="uid://b3diry65fdrj6"]

[ext_resource type="PackedScene" uid="uid://dekuqrdjmnr1m" path="res://Scenes/Prefabs/UI/BasePauseMenu.tscn" id="1_uvhg6"]

[sub_resource type="GDScript" id="GDScript_k4rkm"]
script/source = "extends Node

func restart_run() -> void:
	AudioManager.stop_all_music()
	Global.death_load = true
	Global.clear_saved_values()
	Global.reset_values()
	SpeedrunHandler.timer = 0
	SpeedrunHandler.timer_active = false
	Global.player_power_states = \"0000\"
	if Global.current_game_mode == Global.GameMode.MARATHON_PRACTICE:
		Global.current_level.reload_level()
	else:
		Global.level_num = 1
		Global.world_num = 1
		LevelTransition.level_to_transition_to = Level.get_scene_string(1, 1)
		Global.transition_to_scene(\"res://Scenes/Levels/LevelTransition.tscn\")

func quit_to_menu() -> void:
	AudioManager.stop_all_music()
	SpeedrunHandler.timer = 0
	SpeedrunHandler.timer_active = false
	SpeedrunHandler.ghost_active = false
	Global.transition_to_scene(\"res://Scenes/Levels/TitleScreen.tscn\")
	get_tree().paused = true
	await Global.current_level.tree_exited
	get_tree().paused = false
"

[node name="PauseMenu" instance=ExtResource("1_uvhg6")]

[node name="Label2" parent="Control/PanelContainer/MarginContainer/VBoxContainer" index="1"]
text = "Restart run"

[node name="Handler" type="Node" parent="." index="2"]
script = SubResource("GDScript_k4rkm")

[connection signal="option_1_selected" from="." to="." method="close"]
[connection signal="option_2_selected" from="." to="." method="close"]
[connection signal="option_2_selected" from="." to="Handler" method="restart_run"]
[connection signal="option_4_selected" from="." to="." method="close"]
[connection signal="option_4_selected" from="." to="Handler" method="quit_to_menu"]

[editable path="SettingsMenu"]
[editable path="SettingsMenu/PanelContainer/MarginContainer/VBoxContainer/Video/Language"]
[editable path="SettingsMenu/PanelContainer/MarginContainer/VBoxContainer/Audio/SelectableOptionNode"]
[editable path="SettingsMenu/PanelContainer/MarginContainer/VBoxContainer/Audio/SelectableOptionNode2"]
[editable path="SettingsMenu/PanelContainer/MarginContainer/VBoxContainer/Audio/SelectableOptionNode3"]
