forked from Nekojimi/JackIt
21 lines
452 B
GDScript
21 lines
452 B
GDScript
extends Node
|
|
|
|
signal history_changed(chat: String)
|
|
|
|
var chat_history: Array[String] = []
|
|
|
|
|
|
func send_chat_line(line: String) -> void:
|
|
_send_chat_line.rpc(line)
|
|
|
|
@rpc("any_peer", "call_local", "reliable")
|
|
func _send_chat_line(line: String):
|
|
chat_history.append(line)
|
|
while chat_history.size() > 8:
|
|
chat_history.pop_front()
|
|
|
|
var chat: String = ""
|
|
for history_line in chat_history:
|
|
chat = chat + history_line + "\n"
|
|
history_changed.emit(chat)
|