def build_module_config(path): config_file = info.basename + '/' + info.basename + '_' + path config_manager = ControlledConfigManager(config_file, cvar_prefix='arcjail_{}_'.format( path.replace('/', '_'))) configs.append(config_manager) return config_manager
def uint_handler(cvar): value = int_handler(cvar) if value < 0: raise InvalidValue return value def ufloat_handler(cvar): value = float_handler(cvar) if value < 0: raise InvalidValue return value config_manager = ControlledConfigManager( info.name + "/main", cvar_prefix='mc_') config_manager.section("Logging") cvar_logging_level = config_manager.controlled_cvar( uint_handler, "logging_level", default=4, description=config_strings['logging_level'], ) cvar_logging_areas = config_manager.controlled_cvar( uint_handler, "logging_areas", default=5, description=config_strings['logging_areas'], )
# ============================================================================= # >> IMPORTS # ============================================================================= # Custom Package from controlled_cvars import ControlledConfigManager from controlled_cvars.handlers import int_handler # Class Limit from ..info import info from .strings import config_strings # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= with ControlledConfigManager(info.name + "/main", cvar_prefix='class_limit_') as config_manager: config_manager.section(config_strings['section logging']) cvar_logging_level = config_manager.controlled_cvar( int_handler, "logging_level", default=4, description=config_strings['logging_level'], ) cvar_logging_areas = config_manager.controlled_cvar( int_handler, "logging_areas", default=5, description=config_strings['logging_areas'], )
# ============================================================================= # >> IMPORTS # ============================================================================= # Custom Package from controlled_cvars import ControlledConfigManager from controlled_cvars.handlers import bool_handler, float_handler # PLRBots from ..info import info from .strings import config_strings # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= config_manager = ControlledConfigManager(info.name + "/main", cvar_prefix='bot_damage_') config_manager.section(config_strings['section general']) config_manager.controlled_cvar( bool_handler, "send_popup_on_connect", default=1, description=config_strings['send_popup_on_connect'], ) config_manager.section(config_strings['section damage_to']) config_manager.controlled_cvar( float_handler, "damage_to_lower_multiplier", default=0.33, description=config_strings['damage_to_lower_multiplier'],
def uint_handler(cvar): value = int_handler(cvar) if value < 0: raise InvalidValue return value def ufloat_handler(cvar): value = float_handler(cvar) if value < 0: raise InvalidValue return value config_manager = ControlledConfigManager(info.name, cvar_prefix='digrats_') config_manager.section(config_strings['section debug_settings']) config_manager.controlled_cvar( color_handler, name="debug_breaking_block", default="255,0,0,50", description=config_strings['debug_breaking_block'], ) config_manager.section(config_strings['section block_settings']) config_manager.controlled_cvar( ufloat_handler, name="block_restore_interval", default=0.2, description=config_strings['block_restore_interval'],
# ============================================================================= # >> FUNCTIONS # ============================================================================= def chance_handler(cvar): value = float_handler(cvar) if 0.0 <= value <= 1.0: return value raise InvalidValue # ============================================================================= # >> GLOBAL VARIABLES # ============================================================================= config_manager = ControlledConfigManager( info.name + "/main", cvar_prefix='plrbots_') config_manager.section(config_strings['section setup_time']) config_manager.controlled_cvar( bool_handler, "force_disable_setup_time", default=1, description=config_strings['force_disable_setup_time'], ) config_manager.section(config_strings['section class_changing']) config_manager.controlled_cvar( chance_handler, "class_change_chance", default=0.2, description=config_strings['class_change_chance'],
from controlled_cvars import ControlledConfigManager from controlled_cvars.handlers import int_handler, InvalidValue from .info import info def uint_handler(cvar): val = int_handler(cvar) if val < 0: raise InvalidValue return val with ControlledConfigManager(info.basename, cvar_prefix="sdm_") as config_manager: config_manager.controlled_cvar(uint_handler, "respawn_delay", default=1, description="Respawn delay") config_manager.controlled_cvar(uint_handler, "health_bonus_on_kill", default=15, description="Health bonus on kill") config_manager.controlled_cvar(uint_handler, "protection_timeout", default=1, description="Protection timeout")
def uint_handler(cvar): value = int_handler(cvar) if value < 0: raise InvalidValue return value def ufloat_handler(cvar): value = float_handler(cvar) if value < 0: raise InvalidValue return value config_manager = ControlledConfigManager(info.basename, cvar_prefix="mc_") config_manager.section("Logging") cvar_logging_level = config_manager.controlled_cvar( uint_handler, "logging_level", default=4, description=strings_config["logging_level"] ) cvar_logging_areas = config_manager.controlled_cvar( uint_handler, "logging_areas", default=5, description=strings_config["logging_areas"] ) config_manager.section("Maps Settings") cvar_timelimit = config_manager.controlled_cvar( float_handler, "timelimit", default=-1, description=strings_config["timelimit"] ) config_manager.controlled_cvar( bool_handler, name="instant_change_level", default=0, description=strings_config["instant_change_level"]
from controlled_cvars import ControlledConfigManager from controlled_cvars.handlers import ( bool_handler, float_handler, int_handler, string_handler) from .info import info config_manager = ControlledConfigManager(info.basename, cvar_prefix="tm_") config_manager.controlled_cvar( bool_handler, "enable", default=1, description="Enable/Disable TripMines functionality" ) config_manager.controlled_cvar( bool_handler, "allow_teamkill", default=0, description="Allow/Disallow team kills with trip mines " "(also allows/dissalows destroying friendly mines)" ) config_manager.controlled_cvar( int_handler, "mines_stock", default=3, description="Initial number of mines given to a player. Special values: " "0 - don't give any mines, -1 - infinite mines." "(ONLY SET IT TO -1 WITH NON-ZERO mines_limit OPTION!!!)" ) config_manager.controlled_cvar( int_handler,
def uint_handler(cvar): value = int_handler(cvar) if value < 0: raise InvalidValue return value def ufloat_handler(cvar): value = float_handler(cvar) if value < 0: raise InvalidValue return value config_manager = ControlledConfigManager(info.name + "/main", cvar_prefix='ctf_') config_manager.section(config_strings['section gameplay']) config_manager.controlled_cvar( float_handler, "dropped_flag_return_timeout", default=45.0, description=config_strings['dropped_flag_return_timeout'], ) config_manager.controlled_cvar( bool_handler, "team_can_return_flag", default=0, description=config_strings['team_can_return_flag'], ) config_manager.controlled_cvar(