extends LineEdit signal chat_message_submitted(message: String) func _unhandled_input(event): if Global.interacting_with_ui: return if event.is_action_pressed("open_chat"): call_deferred("grab_focus") func _on_focus_entered(): Global.interacting_with_ui = true func _on_focus_exited(): Global.interacting_with_ui = false func _on_text_submitted(message: String): (owner as UIManager).chat_message_submitted.emit(message) text = "" release_focus()