Skip to content

Commit 6151bca

Browse files
committed
Test & fix self.set_loadout
1 parent cbf9433 commit 6151bca

File tree

7 files changed

+37
-7
lines changed

7 files changed

+37
-7
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "A high performance Python interface for communicating with RLBot
88
dynamic = ["version"]
99
requires-python = ">= 3.11"
1010
dependencies = [
11-
"rlbot_flatbuffers~=0.14.1",
11+
"rlbot_flatbuffers~=0.14.3",
1212
"psutil==7.*",
1313
]
1414
readme = "README.md"

rlbot/managers/bot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def set_loadout(self, loadout: flat.PlayerLoadout):
268268
Does nothing if called outside `initialize` unless state setting is enabled in which case it
269269
respawns the car with the new loadout.
270270
"""
271-
self._game_interface.send_set_loadout(flat.SetLoadout(self.spawn_id, loadout))
271+
self._game_interface.send_set_loadout(flat.SetLoadout(self.index, loadout))
272272

273273
def initialize(self):
274274
"""

rlbot/managers/hivemind.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ def set_game_state(
275275
game_state = fill_desired_game_state(balls, cars, match_info, commands)
276276
self._game_interface.send_game_state(game_state)
277277

278-
def set_loadout(self, loadout: flat.PlayerLoadout, spawn_id: int):
278+
def set_loadout(self, loadout: flat.PlayerLoadout, index: int):
279279
"""
280280
Sets the loadout of a bot.
281281
Can be used to select or generate a loadout for the match when called inside `initialize`.
282282
Does nothing if called outside `initialize` unless state setting is enabled in which case it
283283
respawns the car with the new loadout.
284284
"""
285-
self._game_interface.send_set_loadout(flat.SetLoadout(spawn_id, loadout))
285+
self._game_interface.send_set_loadout(flat.SetLoadout(index, loadout))
286286

287287
def initialize(self):
288288
"""

rlbot/managers/script.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ def set_game_state(
228228
game_state = fill_desired_game_state(balls, cars, match_info, commands)
229229
self._game_interface.send_game_state(game_state)
230230

231-
def set_loadout(self, loadout: flat.PlayerLoadout, spawn_id: int):
231+
def set_loadout(self, loadout: flat.PlayerLoadout, index: int):
232232
"""
233233
Sets the loadout of a bot.
234234
235235
Will be ignored if called when state setting is disabled.
236236
"""
237-
self._game_interface.send_set_loadout(flat.SetLoadout(spawn_id, loadout))
237+
self._game_interface.send_set_loadout(flat.SetLoadout(index, loadout))
238238

239239
def initialize(self):
240240
"""

rlbot/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.0-beta.31"
1+
__version__ = "2.0.0-beta.32"

tests/fashion/bot.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from __future__ import annotations
2+
3+
from rlbot import flat
4+
from rlbot.config import load_player_loadout
5+
from rlbot.managers import Bot
6+
7+
8+
class Fashion(Bot):
9+
def initialize(self):
10+
self.set_loadout(load_player_loadout("../necto/loadout.toml", self.team))
11+
12+
def get_output(self, packet: flat.GamePacket) -> flat.ControllerState:
13+
return flat.ControllerState()
14+
15+
16+
if __name__ == "__main__":
17+
Fashion("testing/fashion").run()

tests/fashion/bot.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[settings]
2+
agent_id = "testing/fashion"
3+
name = "Fashion"
4+
run_command = "..\\..\\venv\\Scripts\\python bot.py"
5+
run_command_linux = "../../venv/bin/python bot.py"
6+
7+
[details]
8+
description = "Made possible by RLBot"
9+
fun_fact = "This is a test bot"
10+
source_link = "https://github.com/RLBot/RLBot"
11+
developer = "BotMaker"
12+
language = "Python 3"
13+
tags = ["memebot"]

0 commit comments

Comments
 (0)