@@ -42,7 +42,12 @@ class AttrDict(dict):
4242
4343
4444class UserMessageCreator (AttrDict ):
45- """Provide an easy interface to create user messages."""
45+ """Provide an easy interface to create user messages.
46+
47+ :attr bool reliable: Whether to send message using reliable channel.
48+ """
49+
50+ reliable = False
4651
4752 def __init__ (self , ** kwargs ):
4853 """Initialize the usermessage creator.
@@ -81,6 +86,7 @@ def _send(self, player_indexes, translated_kwargs):
8186 :param AttrDict translated_kwargs: The translated arguments.
8287 """
8388 recipients = RecipientFilter (* player_indexes )
89+ recipients .reliable = self .reliable
8490 user_message = UserMessage (recipients , self .message_name )
8591
8692 if user_message .is_protobuf ():
@@ -206,6 +212,7 @@ def send(self, *player_indexes):
206212 # this length, we need to sent it in several parts.
207213 if UserMessage .is_protobuf ():
208214 recipients = RecipientFilter (* player_indexes )
215+ recipients .reliable = self .reliable
209216 user_message = UserMessage (recipients , self .message_name )
210217 self .protobuf (user_message .buffer , self )
211218 user_message .send ()
@@ -223,6 +230,7 @@ def bitbuf(self, player_indexes, kwargs):
223230 menu_string = kwargs .menu_string
224231 length = len (menu_string )
225232 recipients = RecipientFilter (* player_indexes )
233+ recipients .reliable = self .reliable
226234 while True :
227235 user_message = UserMessage (recipients , self .message_name )
228236
@@ -246,6 +254,7 @@ class SayText2(UserMessageCreator):
246254
247255 message_name = 'SayText2'
248256 translatable_fields = ['message' , 'param1' , 'param2' , 'param3' , 'param4' ]
257+ reliable = True
249258
250259 def __init__ (
251260 self , message , index = 0 , chat = False ,
@@ -301,6 +310,7 @@ class SayText(UserMessageCreator):
301310
302311 message_name = 'SayText'
303312 translatable_fields = ['message' ]
313+ reliable = True
304314
305315 def __init__ (self , message , index = 0 , chat = False ):
306316 """Initialize the SayText instance."""
@@ -372,6 +382,7 @@ class TextMsg(UserMessageCreator):
372382
373383 message_name = 'TextMsg'
374384 translatable_fields = ['message' , 'param1' , 'param2' , 'param3' , 'param4' ]
385+ reliable = True
375386
376387 def __init__ (
377388 self , message , destination = HudDestination .CENTER ,
0 commit comments