Skip to content

Commit f87ffbd

Browse files
committed
Move can_render into Renderer
1 parent ce1801c commit f87ffbd

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

rlbot/managers/bot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class Bot:
3131
index: int = -1
3232
name: str = ""
3333
player_id: int = 0
34-
can_render: bool = False
3534

3635
@property
3736
def spawn_id(self) -> int:
@@ -247,10 +246,10 @@ def rendering_status_update(self, update: flat.RenderingStatus):
247246
"""
248247
Called when the server sends a rendering status update for ANY bot or script.
249248
250-
By default, this will update `self.can_render` if appropriate.
249+
By default, this will update `self.renderer.can_render` if appropriate.
251250
"""
252251
if update.is_bot and update.index == self.index:
253-
self.can_render = update.status
252+
self.renderer.can_render = update.status
254253

255254
def update_rendering_status(
256255
self,
@@ -261,7 +260,7 @@ def update_rendering_status(
261260
"""
262261
Requests the server to update the status of the ability for this bot to render.
263262
Will be ignored if rendering has been set to AlwaysOff in the match settings.
264-
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.can_render`.
263+
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.renderer.can_render`.
265264
266265
- `status`: `True` to enable rendering, `False` to disable.
267266
- `index`: The index of the bot to update. If `None`, uses the bot's own index.

rlbot/managers/hivemind.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class Hivemind:
3333
indices: list[int] = []
3434
names: list[str] = []
3535
player_ids: list[int] = []
36-
can_render: bool = False
3736

3837
@property
3938
def spawn_ids(self) -> list[int]:
@@ -238,10 +237,10 @@ def rendering_status_update(self, update: flat.RenderingStatus):
238237
"""
239238
Called when the server sends a rendering status update for ANY bot or script.
240239
241-
By default, this will update `self.can_render` if appropriate.
240+
By default, this will update `self.renderer.can_render` if appropriate.
242241
"""
243242
if update.is_bot and update.index in self.indices:
244-
self.can_render = update.status
243+
self.renderer.can_render = update.status
245244

246245
def update_rendering_status(
247246
self,
@@ -252,7 +251,7 @@ def update_rendering_status(
252251
"""
253252
Requests the server to update the status of the ability for this bot to render.
254253
Will be ignored if rendering has been set to AlwaysOff in the match settings.
255-
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.can_render`.
254+
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.renderer.can_render`.
256255
257256
- `status`: `True` to enable rendering, `False` to disable.
258257
- `index`: The index of the bot to update. If `None`, uses the bot's own index.

rlbot/managers/rendering.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class Renderer:
4646
purple = flat.Color(128, 0, 128)
4747
teal = flat.Color(0, 128, 128)
4848

49+
can_render: bool = False
50+
4951
_logger = get_logger("renderer")
5052

5153
_used_group_ids: set[int] = set()

rlbot/managers/script.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class Script:
2626

2727
index: int = 0
2828
name: str = "UnknownScript"
29-
can_render: bool = False
3029

3130
match_config = flat.MatchConfiguration()
3231
field_info = flat.FieldInfo()
@@ -193,10 +192,10 @@ def rendering_status_update(self, update: flat.RenderingStatus):
193192
"""
194193
Called when the server sends a rendering status update for ANY bot or script.
195194
196-
By default, this will update `self.can_render` if appropriate.
195+
By default, this will update `self.renderer.can_render` if appropriate.
197196
"""
198197
if not update.is_bot and update.index == self.index:
199-
self.can_render = update.status
198+
self.renderer.can_render = update.status
200199

201200
def update_rendering_status(
202201
self,
@@ -207,7 +206,7 @@ def update_rendering_status(
207206
"""
208207
Requests the server to update the status of the ability for this bot to render.
209208
Will be ignored if rendering has been set to AlwaysOff in the match settings.
210-
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.can_render`.
209+
If the status is successfully updated, the `self.rendering_status_update` method will be called which will update `self.renderer.can_render`.
211210
212211
- `status`: `True` to enable rendering, `False` to disable.
213212
- `index`: The index of the bot to update. If `None`, uses the script's own index.

0 commit comments

Comments
 (0)