File tree Expand file tree Collapse file tree 5 files changed +77
-14
lines changed
Expand file tree Collapse file tree 5 files changed +77
-14
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def __init__(self):
4444 self ._game_interface .match_settings_handlers .append (self ._handle_match_settings )
4545 self ._game_interface .field_info_handlers .append (self ._handle_field_info )
4646 self ._game_interface .match_communication_handlers .append (
47- self .handle_match_communication
47+ self ._handle_match_communication
4848 )
4949 self ._game_interface .ball_prediction_handlers .append (
5050 self ._handle_ball_prediction
@@ -186,8 +186,26 @@ def run(
186186 self .retire ()
187187 del self ._game_interface
188188
189- def handle_match_communication (self , match_comm : flat .MatchComm ):
190- pass
189+ def _handle_match_communication (self , match_comm : flat .MatchComm ):
190+ self .handle_match_communication (
191+ match_comm .index ,
192+ match_comm .team ,
193+ match_comm .content ,
194+ match_comm .display ,
195+ match_comm .team_only ,
196+ )
197+
198+ def handle_match_communication (
199+ self ,
200+ index : int ,
201+ team : int ,
202+ content : bytes ,
203+ display : Optional [str ],
204+ team_only : bool ,
205+ ):
206+ """
207+ Called when a match communication is received.
208+ """
191209
192210 def send_match_comm (
193211 self , content : bytes , display : Optional [str ] = None , team_only : bool = False
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def __init__(self):
4646 self ._game_interface .match_settings_handlers .append (self ._handle_match_settings )
4747 self ._game_interface .field_info_handlers .append (self ._handle_field_info )
4848 self ._game_interface .match_communication_handlers .append (
49- self .handle_match_communication
49+ self ._handle_match_communication
5050 )
5151 self ._game_interface .ball_prediction_handlers .append (
5252 self ._handle_ball_prediction
@@ -191,8 +191,26 @@ def get_ball_prediction(self) -> flat.BallPrediction:
191191 """
192192 return self .ball_prediction
193193
194- def handle_match_communication (self , match_comm : flat .MatchComm ):
195- pass
194+ def _handle_match_communication (self , match_comm : flat .MatchComm ):
195+ self .handle_match_communication (
196+ match_comm .index ,
197+ match_comm .team ,
198+ match_comm .content ,
199+ match_comm .display ,
200+ match_comm .team_only ,
201+ )
202+
203+ def handle_match_communication (
204+ self ,
205+ index : int ,
206+ team : int ,
207+ content : bytes ,
208+ display : Optional [str ],
209+ team_only : bool ,
210+ ):
211+ """
212+ Called when a match communication is received.
213+ """
196214
197215 def send_match_comm (
198216 self ,
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def __init__(self):
4040 self ._game_interface .match_settings_handlers .append (self ._handle_match_settings )
4141 self ._game_interface .field_info_handlers .append (self ._handle_field_info )
4242 self ._game_interface .match_communication_handlers .append (
43- self .handle_match_communication
43+ self ._handle_match_communication
4444 )
4545 self ._game_interface .ball_prediction_handlers .append (
4646 self ._handle_ball_prediction
@@ -105,8 +105,26 @@ def run(
105105 self .retire ()
106106 del self ._game_interface
107107
108- def handle_match_communication (self , match_comm : flat .MatchComm ):
109- pass
108+ def _handle_match_communication (self , match_comm : flat .MatchComm ):
109+ self .handle_match_communication (
110+ match_comm .index ,
111+ match_comm .team ,
112+ match_comm .content ,
113+ match_comm .display ,
114+ match_comm .team_only ,
115+ )
116+
117+ def handle_match_communication (
118+ self ,
119+ index : int ,
120+ team : int ,
121+ content : bytes ,
122+ display : Optional [str ],
123+ team_only : bool ,
124+ ):
125+ """
126+ Called when a match communication is received.
127+ """
110128
111129 def send_match_comm (
112130 self , content : bytes , display : Optional [str ] = None , team_only : bool = False
Original file line number Diff line number Diff line change 1- __version__ = "5.0.0-beta.4 "
1+ __version__ = "5.0.0-beta.5 "
22
33
44RESET_SEQ = "\033 [0m"
@@ -15,6 +15,9 @@ def _get_color(color: int) -> str:
1515)
1616
1717RELEASE_NOTES = {
18+ "5.0.0-beta.5" : """
19+ Better handle `handle_match_communication` API
20+ """ ,
1821 "5.0.0-beta.4" : """
1922 Better state setting API
2023 """ ,
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import math
4+ from typing import Optional
45
56from rlbot import flat
67from rlbot .managers import Bot
@@ -77,10 +78,15 @@ def initialize_agent(self):
7778 )
7879 self .renderer .end_rendering ()
7980
80- def handle_match_communication (self , match_comm : flat .MatchComm ):
81- self .logger .info (
82- f"Received match communication from index { match_comm .index } ! { match_comm .display } "
83- )
81+ def handle_match_communication (
82+ self ,
83+ index : int ,
84+ team : int ,
85+ content : bytes ,
86+ display : Optional [str ],
87+ team_only : bool ,
88+ ):
89+ self .logger .info (f"Received match communication from index { index } ! { display } " )
8490
8591 def get_output (self , packet : flat .GameTickPacket ) -> flat .ControllerState :
8692 if self .rendering :
You can’t perform that action at this time.
0 commit comments