@@ -19,6 +19,7 @@ const PLACEHOLDER = "T to chat, /g global, /l local, /w NAME whisper, /r reply"
19
19
func _ready ():
20
20
Com .controls .connect ("key_press" , self , "on_key_press" )
21
21
Network .connect ("chat_message" , self , "on_message_get" )
22
+ Com .game .connect ("player_joined" , self , "on_new_player" )
22
23
input .placeholder_text = PLACEHOLDER
23
24
24
25
func on_message_get (type , from , message ):
@@ -27,13 +28,17 @@ func on_message_get(type, from, message):
27
28
if type == Data .CHATS .WHISPER :
28
29
last_whisper = from
29
30
31
+ func on_new_player (uname ):
32
+ return # spam
33
+ add_message (null , uname + " joined the room" , Data .CHATS .SYSTEM )
34
+
30
35
func add_message (author , message , type = mode , add_whisper = false ):
31
36
history .push_color ("#" + chat_colors [type ].to_html ())
32
- history .add_text (mode_text (type , add_whisper ))
37
+ if type != Data . CHATS . SYSTEM : history .add_text (mode_text (type , add_whisper ))
33
38
history .pop ()
34
39
35
40
history .push_color ("#" + chat_colors [type ].lightened (0.5 ).to_html ())
36
- history .append_bbcode (str ("[b]" , author , ":[/b] " ))
41
+ if author : history .append_bbcode (str ("[b]" , author , ":[/b] " ))
37
42
history .pop ()
38
43
39
44
history .add_text (str (message , "\n " ))
0 commit comments