Exemple #1
0
// add or remove bots to match team size targets set by 'bot fill' command
void G_BotFill(bool immediately)
{
	static int nextCheck = 0;
	if (!immediately && level.time < nextCheck) {
		return;  // don't check every frame to prevent warning spam
	}
	nextCheck = level.time + 2000;

	for (team_t team : {TEAM_ALIENS, TEAM_HUMANS}) {
		auto& t = level.team[team];
		int teamSize = t.numClients;
		if (teamSize > t.botFillTeamSize && t.numBots > 0) {
			for (int client = 0; client < MAX_CLIENTS; client++) {
				if (level.clients[client].pers.connected == CON_CONNECTED
						&& level.clients[client].pers.team == team
						&& level.clients[client].pers.isFillerBot) {
					G_BotDel(client);
					if (--teamSize <= t.botFillTeamSize) {
						break;
					}
				}
			}
		} else if (teamSize < t.botFillTeamSize) {
			int additionalBots = t.botFillTeamSize - teamSize;
			while (additionalBots--) {
				if (!G_BotAdd(BOT_NAME_FROM_LIST, team, t.botFillSkillLevel, BOT_DEFAULT_BEHAVIOR, true)) {
					break;
				}
			}
		}
	}
}
Exemple #2
0
/**
 * Removes and add again a Bot (unused?)
 * @param self [gentity_t] a BOT
 */
void G_BotReload( gentity_t *ent, int clientNum )
{
	ClientDisconnect( clientNum );
	G_BotAdd( ent->client->pers.netname, ent->client->pers.teamSelection );
	trap_SendServerCommand( -1, "print \"Interfering bot reloaded\n\"" );
}
Exemple #3
0
/**
 * Add a random bot to a team
 * @param team
 */
void G_BotAddRandom ( team_t team ) {
	int ini, fin, sel;
	char name[MAX_NAME_LENGTH];
	const char *names[50] = {
		//------------- ALIENS
		"Fringe", 
		"Kesh", 
		"Ditto", 
		"MonsterPocket", 
		"Chiaka", 
		
		"Shinsho", 
		"Watto", 
		"Worf", 
		"Klaatu", 
		"LordNibbler", 
		
		"Tarantula", 
		"URTasty", 
		"BlackWidow", 
		"MoonWalker", 
		"BaByBoom", 
		
		"Mufasa", 
		"Armadillo", 
		"FreakMonkey", 
		"GotMilk", 
		"DaKilla", 
		
		"FunkyChicken", 
		"WantMore", 
		"Pringles", 
		"Godzilla", 
		"KissMyAxe", 
		
		//------------ HUMANS 
		
		"Quorra", 
		"RandomClu", 
		"C-Tron", 
		"Erroronous", 
		"SegFault", 
		
		"HeartBleed", 
		"Tenshion", 
		"2-OP-4U", 
		"UrMamma", 
		"DiePanzerkraft", 
		
		"Johnny5", 
		"NorthPark", 
		"Hallucinogen", 
		"HateMe", 
		"ManiacPsycho", 
		
		"CoreDump", 
		"AfroHead", 
		"FuzzyLogic", 
		"SexyChick", 
		"IOU-Sucka", 
		
		"TeamKiller", 
		"Messiah", 
		"ZeroSystem", 
		"CltrAltDel", 
		"OptimusPrime", 
	};
	int reservedSlots = trap_Cvar_VariableIntegerValue( "sv_privateclients" );
	ini = team == TEAM_ALIENS ? 0 : 25;
	fin = team == TEAM_ALIENS ? 26 : 49;
	//Do not add more than we can handle
	if(level.humanBots + level.alienBots < reservedSlots) {
		do {
			sel = G_Rand_Range(ini,fin);
			Q_strncpyz( name, names[sel], sizeof( name ) );
		} while(!G_BotAdd(name, team));	
	}
}