11import os
22from traceback import print_exc
3- from typing import Optional
43
54from rlbot import flat
65from rlbot .interface import (
1312from rlbot .utils import fill_desired_game_state
1413from rlbot .utils .logging import DEFAULT_LOGGER , get_logger
1514
16- WARNED_SPAWN_ID_DEPRECATED = False
17-
1815
1916class Bot :
2017 """
@@ -32,17 +29,6 @@ class Bot:
3229 name : str = ""
3330 player_id : int = 0
3431
35- @property
36- def spawn_id (self ) -> int :
37- global WARNED_SPAWN_ID_DEPRECATED
38- if not WARNED_SPAWN_ID_DEPRECATED :
39- WARNED_SPAWN_ID_DEPRECATED = True
40- self .logger .warning (
41- "'spawn_id' getter accessed, which is deprecated in favor of 'player_id'."
42- )
43-
44- return self .player_id
45-
4632 match_config = flat .MatchConfiguration ()
4733 """
4834 Contains info about what map you're on, game mode, mutators, etc.
@@ -63,10 +49,10 @@ def spawn_id(self) -> int:
6349 _has_field_info = False
6450 _has_player_mapping = False
6551
66- _latest_packet : Optional [ flat .GamePacket ] = None
52+ _latest_packet : flat .GamePacket | None = None
6753 _latest_prediction = flat .BallPrediction ()
6854
69- def __init__ (self , default_agent_id : Optional [ str ] = None ):
55+ def __init__ (self , default_agent_id : str | None = None ):
7056 agent_id = os .environ .get ("RLBOT_AGENT_ID" ) or default_agent_id
7157
7258 if agent_id is None :
@@ -107,7 +93,7 @@ def _try_initialize(self):
10793 return
10894
10995 for player in self .match_config .player_configurations :
110- match player .variety . item :
96+ match player .variety :
11197 case flat .CustomBot (name ):
11298 if player .player_id == self .player_id :
11399 self .name = name
@@ -253,7 +239,7 @@ def rendering_status_update(self, update: flat.RenderingStatus):
253239 def update_rendering_status (
254240 self ,
255241 status : bool ,
256- index : Optional [ int ] = None ,
242+ index : int | None = None ,
257243 is_bot : bool = True ,
258244 ):
259245 """
@@ -274,7 +260,7 @@ def handle_match_comm(
274260 index : int ,
275261 team : int ,
276262 content : bytes ,
277- display : Optional [ str ] ,
263+ display : str | None ,
278264 team_only : bool ,
279265 ):
280266 """
@@ -284,7 +270,7 @@ def handle_match_comm(
284270 """
285271
286272 def send_match_comm (
287- self , content : bytes , display : Optional [ str ] = None , team_only : bool = False
273+ self , content : bytes , display : str | None = None , team_only : bool = False
288274 ):
289275 """
290276 Emits a match communication message to other bots and scripts.
@@ -307,7 +293,7 @@ def set_game_state(
307293 self ,
308294 balls : dict [int , flat .DesiredBallState ] = {},
309295 cars : dict [int , flat .DesiredCarState ] = {},
310- match_info : Optional [ flat .DesiredMatchInfo ] = None ,
296+ match_info : flat .DesiredMatchInfo | None = None ,
311297 commands : list [str ] = [],
312298 ):
313299 """
@@ -319,7 +305,7 @@ def set_game_state(
319305 game_state = fill_desired_game_state (balls , cars , match_info , commands )
320306 self ._game_interface .send_msg (game_state )
321307
322- def set_loadout (self , loadout : flat .PlayerLoadout , index : Optional [ int ] = None ):
308+ def set_loadout (self , loadout : flat .PlayerLoadout , index : int | None = None ):
323309 """
324310 Sets the loadout of a bot.
325311 Can be used to select or generate a loadout for the match when called inside `initialize`.
0 commit comments