@tool class_name ActionPrompt extends Control ## ## The prompt accept button has been pressed. ## signal prompt_accepted() ## ## The prompt has been started. ## signal prompted() @export var _accept_button: BaseButton = null ## ## The initial control focused on when it is prompted or [code]null[/code] for no default. ## @export var initial_focus: Control = null func _get_configuration_warnings() -> PackedStringArray: var warnings := PackedStringArray() if _accept_button == null: warnings.append("`Accept Button` must point to a valid BaseButton instance") return warnings func _ready() -> void: assert(_accept_button != null, "accept button cannot be null") _accept_button.pressed.connect(func () -> void: prompt_accepted.emit() hide()) ## ## Starts the prompt, emitting [signal prompted]. ## ## [signal prompt_accepted] is emitted when the accept button in the action prompt is pressed. ## func prompt() -> void: LocalPlayer.override_controls(hidden) show() prompted.emit() if initial_focus != null: initial_focus.grab_focus()