Skip to content

Commit d43cb93

Browse files
Merge pull request #26 from RLBot/no_path
Allow `path` in `load_player_config` to be `None`
2 parents 1b12fcc + 14f96e9 commit d43cb93

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

rlbot/config.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def load_player_loadout(path: Path | str, team: int) -> flat.PlayerLoadout:
217217

218218

219219
def load_player_config(
220-
path: Path | str,
220+
path: Path | str | None,
221221
type: flat.CustomBot | flat.Psyonix,
222222
team: int,
223223
name_override: str | None = None,
@@ -227,6 +227,20 @@ def load_player_config(
227227
Reads the bot toml file at the provided path and
228228
creates a `PlayerConfiguration` of the given type for the given team.
229229
"""
230+
if path is None:
231+
loadout = (
232+
load_player_loadout(loadout_override, team)
233+
if loadout_override is not None
234+
else None
235+
)
236+
237+
return flat.PlayerConfiguration(
238+
type,
239+
name_override or "",
240+
team,
241+
loadout=loadout,
242+
)
243+
230244
path = Path(path)
231245
with open(path, "rb") as f:
232246
config = tomllib.load(f)

rlbot/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.0-beta.41"
1+
__version__ = "2.0.0-beta.42"

tests/nexto/toxic.bot.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#:schema https://rlbot.org/schemas/agent.json
12
[settings]
23
name = "Nexto (Toxic!)"
34
loadout_file = "loadout.toml"

tests/psy.toml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ game_map_upk = "Stadium_P"
99

1010
[[cars]]
1111
team = 0
12-
config_file = "psy/bot.toml"
1312
type = "Psyonix"
1413
skill = "Beginner"
1514

0 commit comments

Comments
 (0)