Member
Join Date: Aug 2015
Location: mb
|
12-06-2015
, 23:09
[L4D2] Survivor Bot Controller v1.5
|
#1
|
FRAMEWORK: Bot Controller primarily acts as a framework; It's created with basic function in mind, that to generally replicate several of the desired features of a plugin such as Bebop or Super Versus. Currently, natives are implemented to provide other plugins access to build on top of the framework. Designing the plugin in this way allows me to update the framework with new features, bug fixes, and other updates, without damaging the development of plugins built to use the framework. Think of Bot Controller as the tree trunk, and the plugins that use it are like branches. The trunk might change and evolve, but the branches will always be compatible.
BOT CONTROLLER CONFIG: The Bot Controller Framework doesn't actually have its own config. Instead, I've written a separate plugin which optionally provides a config and creates custom CVars to accompany it. This design decision was made to provide the plugin in an accessible way to server operators without stepping on the toes of developers. It is accompanied by a self-generated config in /cfg/sourcemod/bc_config.cfg
This feature was requested by mcgill
VERSION HISTORY: From v1.1.3 and forward, I'll be including a revision history.
PHP Code:
v1.5 - 01 / 13 / 2016 - OnAnyClientLoaded(client) forward added. - sm_assign_teams added. - Defaulted to "1" and "0" disables, but another plugin would have to handle team assignments if this is the case. By default, if the infected limit is < 1, players will be assigned survivor. Otherwise, the team with the least players, otherwise a random team.
v1.4.4 - 12 / 14 / 2015 - Survivors should now be able to go idle without their bot being removed from the server. - Patched an improper order of operations. - Survivor Bots will be removed if there are more than the required Survivor players, when a player goes idle. + If a player is moved to spectator through the "Take A Break" menu option / go_away_from_keyboard, the player can still press their PRIMARY ATTACK button to rejoin, even though the prompts will not be visible. + Players who join the Spectator team in any other method will need to use the jointeam option to re-enter the game.
v1.4.3 - 12 / 13 / 2015 - Patched an array out of bounds error.
v1.4.2 - 12 / 12 / 2015
- Bot Controller Config updated to version dev-c. + Requested by Acid_Monk - sm_tank_health The base health for tanks. 0 to ignore CVar. - sm_tank_health_modifier The health (per survivor) to give the tank. 0 to ignore CVar. - sm_preserve_teams If 1, we dont allow teams to jumble when a map changes. - sm_extrameds Players who join survivors BEFORE the round begins will receive a medkit if set to 1. - Corrected a bug where bots were not properly regulated, when allowed, when a player left the game.
v1.4.1 - 12 / 11 / 2015 - Added a new forward, while amending the name of another to match the naming convention used for Forwards. + OnBotCreatedFwd renamed from OnBotCreated. + OnFirstClientLoadedFwd added. - Bot Controller Config is officially released, requires v1.4 or greater of the framework. - Requested by mcgill - Adds CVars to many important functions, allowing non-developer server-operators the ability to manipulate the framework. A config will be generated located at /cfg/sourcemod/bc_config.cfg
sm_survivor_limit default: 4 Maximum survivor players. sm_infected_limit default: 4 Maximum infectedplayers. sm_survivor_minimum default: 4 Minimum survivors required (bots make difference). sm_reserveslots default: 2 Number of reserve slots. sm_playerslots default: 8 Number of playable slots (should be survivorlimit + infectedlimit + speclimit). sm_reserveslots_delay default: 30 Timer delay to kick player for reservation. 0 for instant kick.
v1.3.2 - 12 / 10 / 2015 - A new native & forward as requested by DeathChaos25. + OnRequestSurvivorBotRegulation() native added. + OnRequestSurvivorBotRegulationFwd() forward added.
v1.3.1 - 12 / 10 / 2015 - Reserve Slot Management Integration
v1.2.1 - native OnSlotManagement added to the library. - Added a LogError() to the OnRegulateSurvivorBots() native. If the native is called, but self-regulation is enabled; OnBlockSurvivorBotRegulation() has never been called, so the plugin calls OnRegulateSurvivorBots() on its own, which could potentially cause issues - if this event occurs, it will simply ignore the request and log the error. - Added additional comments in the code for developers. Even a request, *hint* *hint*
v1.1.3 - forward OnBotCreated added to the library.
BOT CONTROLLER LIBRARY: Below is a list of all of the current natives and forwards included in this framework - If you're a developer and have requests for this section, please post your request, and I'll see if it can be done.
PHP Code:
/* * Calling this native will force the plugin to regulate the survivor bots based * on whatever the current survivor minimum and maximum requirements are. * */ native OnRegulateSurvivorBots();
/* * Forces the player to attempt to join the survivor team - or create bots. See params. * * @param client If set to 0, will create a bot but not assign a player to it. * Will do nothing if the survivor limit has been reached. * */ native OnJoinSurvivorTeam(client);
/* * Sets the Survivor Minimum and Maximum requirements. OnRegulateSurvivorBots() will not * be called if BotRegulation override is enabled. * * @param min The minimum number of survivors that MUST exist. Humans + Bots. * @param max The maximum number of survivors that CAN exist. * */ native OnSetSurvivorRequirements(min, max);
/* * Will block BotControl core from running any Survivor Bot Restriction Regulation functions. * If the function is blocked, the OnRegulateSurvivorBots() native must be called for these * functions to be performed. * */ native OnBlockSurvivorBotRegulation();
/* * * Will allow BotControl core to run all Survivor Bot Restriction Regulation functions. * This is the default setting. Don't forget to call this OnPluginEnd() if your plugin * blocks the functionality!!! * */ native OnAllowSurvivorBotRegulation();
/* * * Allows the creation of a custom number of survivor bots. * Important: Disable SurvivorBotRegulation by the core plugin before using this native. * * @param count The number of Survivor Bots to create. * */ native OnCreateSurvivorBots(count);
/* * * Allows the destruction of a custom number of survivor bots. * Important: This will not remove bots that are tied to idle players. * * @param count The number of Survivor Bots to destroy. * */ native OnDestroySurvivorBots(count);
/* * * Allows the setting and management of both infected and survivor team limits. * * @param survivorLimit Must be a value greater than 0 or will be ignored. * @param infectedLimit Must be a value greater or equal to 0 or will be ignored. * */ native OnSlotManagement(survivorLimit, infectedLimit);
/* * * Adjusts the values, permanently, of reserve slots. * * @param reserveslots The number of non-playable (unless under special circumstances) slots on the server. * @param maximumslots The number of maximum always-playable slots on the server. Make sure maxplayers is reserveslots + maximumslots. * @param kickdelay The time in seconds (int) until the player is removed (if there are reserve slots available for the connecting player) * otherwise the player receives no notice and is removed immediately for the connecting player. * */ native OnReserveSlotManagement(reserveslots, maximumslots, kickdelay);
/* * * Enables reserve slots management on the server. Note, this DOES NOT set the reserve slots, the maximum slots, and the kick delay. * You MUST call OnReserveSlotManagement native (above) and set the values before enabling this (or all hell will break loose) * */ native OnAllowReserveSlots();
/* * * The opposite of enabling. * */ native OnBlockReserveSlots();
/* * * Provides plugins more detailed / selective options for WHICH survivor bots to remove. * Hope to find a way to add more than a static number of options. * * @param count The plugin will kick UP TO this amount of bots (if applicable) * @param reqs 1 - Only one condition must pass on a bot to remove it. 2 - All received conditions must pass to remove the bot. * @param param1 Currently, the native supports UP TO 3 UNIQUE params. Your options are, for example: * * ".mdl" in a param will check the param string against the bot survivor model. * "!dead" as a param will require bots to be not dead. * "dead" as a param will require bots to be dead. * *NOTE* -> You could use 3 different models as your params, if for example, you wanted to remove bots of all those * models. However, for that to work, reqs would have to be set to 1. * * I'd really love to add more, or, if possible, IF GetNativeArray will allow me to pass an ADT Array... * !-- IMPORTANT --! * Because this native is expected to be used under special circumstances, it DOES NOT adjust the survivor bot minimum * requirement after kicking bots in this way, in the assumption that an author will do something with the forward that * immediately follows, OnDestroySurvivorBotsFwd. * */ native OnDestroySurvivorBotsEx(count, reqs, String:param1[], String:param2[], String:param3[]);
/* * * The only purpose of this native is to request whether Bot Regulation is enabled or disabled on the core plugin. * Will shoot off the OnRequestSurvivorBotRegulationFwd forward. * */ native OnRequestSurvivorBotRegulation();
/* * * When a new bot is created, sends out information about the bot and new client. * Requested by DeathChaos25 * * @Param client The Client ID of the player who will be taking ownership of the bot. * @Param cnetp The net prop ID of the bot. * @Param cmodel The character model of the bot. * */ forward OnBotCreatedFwd(client, cnetp, String:cmodel[]);
/* * * After all eligible bots have been removed, this forward fires, notifying plugins of the number * of bots that were removed - it's possible the number may differ from the value the plugin that * triggered this forward requested be removed. * * @Param count The number of survivor bots that were kicked through OnDestroySurvivorBotsEx native. * */ forward OnDestroySurvivorBotsFwd(count);
/* * * This forward is called when OnRequestSurvivorBotRegulation native is called. It will notify any listening * plugins on whether or not Bot Regulation is automated through the plugin or not. * * @Bool IsEnabled 0 for disabled, 1 for enabled. * */ forward OnRequestSurvivorBotRegulationFwd(bool:IsEnabled);
/* * * This forward is called when the first client loads into the game. * */ forward OnFirstClientLoadedFwd();
Last edited by jess; 01-13-2016 at 17:25.
Reason: SBC v1.5
|
|