diff --git a/botroyale/default_settings.toml b/botroyale/default_settings.toml index 9758c31..37fc8e0 100644 --- a/botroyale/default_settings.toml +++ b/botroyale/default_settings.toml @@ -4,6 +4,10 @@ default_map = "basic" default_step_rate = 2 # Game speed options toggle_step_rates = [1, 2, 3, 5, 60] +# Select these bots automatically (case sensitive) +auto_select_bots = [ + # "basic", +] [logging] global = true diff --git a/botroyale/logic/game.py b/botroyale/logic/game.py index df212a6..1cf28c8 100644 --- a/botroyale/logic/game.py +++ b/botroyale/logic/game.py @@ -4,6 +4,7 @@ """ from typing import Any, Union, Optional from botroyale.gui import logger +from botroyale.util import settings from botroyale.api.gui import GameAPI, InputWidget from botroyale.api.bots import BOTS, BotSelection, NotFairError from botroyale.logic.maps import MAPS, DEFAULT_MAP_NAME, get_map_state @@ -12,6 +13,7 @@ BOT_SENDTO_PREFIX = "╠" +AUTO_SELECT_BOTS = settings.get("battle.auto_select_bots") def _get_sorted_bots(): @@ -37,7 +39,11 @@ class StandardGameAPI(GameAPI): def __init__(self, *args, **kwargs): """Initialize the class.""" super().__init__(*args, **kwargs) - self.selected_bots = [] + self.selected_bots = [ + BOTS[bot_name] + for bot_name in AUTO_SELECT_BOTS + if bot_name in BOTS + ] self.menu_values = dict( editor=False, map=DEFAULT_MAP_NAME,