@tool extends Button ## A button representing a specific action, and offering a default prompt that can be changed class_name PromptButton signal performed(action: StringName) @onready var action_prompt : ActionPrompt = $ActionPrompt @export_custom(PROPERTY_HINT_INPUT_NAME, "show_builtin") var action : StringName = &"ui_accept": set(value): action = value if is_node_ready(): _update_action() else: _update_action.call_deferred() get: return action func _ready(): PromptManager.icons_changed.connect(action_prompt._refresh) self.pressed.connect(perform) action_prompt.pressed.connect(perform) func perform() -> void: performed.emit(action) func _update_action(): text = action $ActionPrompt.action = action func _override_prompt(prompt: String): if prompt: text = prompt else: text = action func appear(prompt: String = "") -> void: _override_prompt(prompt) show() func vanish() -> void: hide()