Example #1
0
def parse_match_config(config_parser: ConfigObject, config_location,
                       config_bundle_overrides,
                       looks_config_overrides) -> MatchConfig:

    match_config = MatchConfig()
    match_config.mutators = MutatorConfig()

    # Determine number of participants
    num_players = get_num_players(config_parser)

    parse_match_settings(match_config, config_parser)

    # Retrieve bot config files
    config_bundles = get_bot_config_bundles(num_players, config_parser,
                                            config_location,
                                            config_bundle_overrides)

    match_config.player_configs = []

    human_index_tracker = IncrementingInteger(0)

    # Set configuration values for bots and store name and team
    for i in range(num_players):

        config_bundle = config_bundles[i]

        looks_config_object = None
        if i in looks_config_overrides:
            looks_config_object = looks_config_overrides[i]

        player_config = _load_bot_config(i, config_bundle, looks_config_object,
                                         config_parser, human_index_tracker)

        match_config.player_configs.append(player_config)

    extension_path = config_parser.get(RLBOT_CONFIGURATION_HEADER,
                                       EXTENSION_PATH_KEY)
    if extension_path and extension_path != 'None':  # The string 'None' ends up in people's config a lot.
        match_config.extension_config = ExtensionConfig()
        match_config.extension_config.python_file_path = extension_path

    match_config.networking_role = config_parser.get(
        RLBOT_CONFIGURATION_HEADER, NETWORKING_ROLE_KEY)
    match_config.network_address = config_parser.get(
        RLBOT_CONFIGURATION_HEADER, NETWORK_ADDRESS_KEY)

    match_config.script_configs = [
        ScriptConfig(bundle.config_path)
        for bundle in get_script_config_bundles(config_parser, config_location)
    ]

    return match_config
Example #2
0
def create_script_config(script):
    return ScriptConfig(script['path'])
Example #3
0
def script_path_to_script_config(script_path):
    script_path = collapse_path(script_path)
    return ScriptConfig(script_path)