add message_sent signal to consoler

This commit is contained in:
2025-02-15 02:14:27 +10:00
parent f9603e0a5a
commit f10eebd332
2 changed files with 14 additions and 10 deletions

View File

@@ -1,6 +1,9 @@
extends Node
signal message_sent(message: String)
var input_thread: Thread
var stop: bool = false
func _enter_tree() -> void:
@@ -9,15 +12,15 @@ func _enter_tree() -> void:
func _exit_tree() -> void:
stop = true
input_thread.wait_to_finish()
func _process_input() -> void:
var text := ""
while text != "quit":
print("Insert some text: ")
while not stop and text != "quit":
text = OS.read_string_from_stdin().strip_edges()
print("Inserted text: ",text)
if Referencer.chat:
Referencer.chat.send_server_message(text)
get_tree().quit()
if text and Referencer.chat:
print("Inserted text: ", text)
message_sent.emit(text)
print("STOPPING!")