Skip to content

Allow path in load_player_config to be None #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion rlbot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def load_player_loadout(path: Path | str, team: int) -> flat.PlayerLoadout:


def load_player_config(
path: Path | str,
path: Path | str | None,
type: flat.CustomBot | flat.Psyonix,
team: int,
name_override: str | None = None,
Expand All @@ -227,6 +227,20 @@ def load_player_config(
Reads the bot toml file at the provided path and
creates a `PlayerConfiguration` of the given type for the given team.
"""
if path is None:
loadout = (
load_player_loadout(loadout_override, team)
if loadout_override is not None
else None
)

return flat.PlayerConfiguration(
type,
name_override or "",
team,
loadout=loadout,
)

path = Path(path)
with open(path, "rb") as f:
config = tomllib.load(f)
Expand Down
2 changes: 1 addition & 1 deletion rlbot/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0-beta.41"
__version__ = "2.0.0-beta.42"
1 change: 1 addition & 0 deletions tests/nexto/toxic.bot.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#:schema https://rlbot.org/schemas/agent.json
[settings]
name = "Nexto (Toxic!)"
loadout_file = "loadout.toml"
Expand Down
1 change: 0 additions & 1 deletion tests/psy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ game_map_upk = "Stadium_P"

[[cars]]
team = 0
config_file = "psy/bot.toml"
type = "Psyonix"
skill = "Beginner"

Expand Down