extends Popup func trigger_pause() -> void: popup() get_tree().paused = true func end_pause() -> void: get_tree().paused = false func _input(event: InputEvent) -> void: if event is InputEventKey: if event.is_action_pressed("ui_home"): if get_tree().paused: hide() else: trigger_pause() func _on_self_popup_hide() -> void: end_pause()