extends PanelContainer const GENERAL = "GENERAL" const SHOW_TUTORIAL = "SHOW_TUTORIAL" var original_state = {} @onready var show_tutorial = $MarginContainer/VBoxContainer/Tabs/General/GridContainer/TutorialCheckBox @onready var discard_button = $MarginContainer/VBoxContainer/Buttons/Discard func _ready(): discard_button.text = "BACK" original_state[SHOW_TUTORIAL] = Config.content.get_value("GENERAL", SHOW_TUTORIAL) show_tutorial.button_pressed = original_state[SHOW_TUTORIAL] func _process(_delta): if Input.is_action_just_pressed("ui_cancel"): self._on_discard_pressed() func _on_discard_pressed(): get_tree().change_scene_to_file("res://screens/main_menu.tscn") func _on_save_pressed(): Config.content.set_value(GENERAL, SHOW_TUTORIAL, show_tutorial.button_pressed) Config.save_changes() get_tree().change_scene_to_file("res://screens/main_menu.tscn") func update_discard_button(): var dirty = \ original_state[SHOW_TUTORIAL] != show_tutorial.button_pressed discard_button.text = "DISCARD" if dirty else "BACK"