예제 #1
0
파일: bot_spawn.c 프로젝트: ZwS/qudos
///////////////////////////////////////////////////////////////////////
// Spawn the bot
///////////////////////////////////////////////////////////////////////
void BOT_SpawnBot (char *team, char *name, char *skin, char *userinfo)
{
	edict_t	*bot;

	if( !nav.loaded ) {
		Com_Printf("Can't spawn bots without a valid navigation file\n");
		return;
	}
	
	bot = BOT_FindFreeClient ();
	
	if (!bot)
	{
		safe_bprintf (PRINT_MEDIUM, "Server is full, increase Maxclients.\n");
		return;
	}

	//init the bot
	bot->inuse = true;
	bot->yaw_speed = 100;

	// To allow bots to respawn
	if(userinfo == NULL)
		BOT_SetName(bot, name, skin, team);
	else
		ClientConnect (bot, userinfo);
	
	G_InitEdict (bot);
	G_SpawnAI(bot); //jabot092(2)
	bot->ai->is_bot = true;
	InitClientResp (bot->client);

	PutClientInServer(bot);
	BOT_StartAsSpectator (bot);

	//skill
	bot->ai->pers.skillLevel = (int)(random()*MAX_BOT_SKILL);
	if (bot->ai->pers.skillLevel > MAX_BOT_SKILL)	//fix if off-limits
		bot->ai->pers.skillLevel =  MAX_BOT_SKILL;
	else if (bot->ai->pers.skillLevel < 0)
		bot->ai->pers.skillLevel =  0;

	BOT_DMclass_InitPersistant(bot);
	AI_ResetWeights(bot);
	AI_ResetNavigation(bot);

	bot->think = BOT_JoinGame;
	bot->nextthink = level.time + (int)(random()*6.0);
	if( ctf->value && team != NULL )
	{
		if( !Q_stricmp( team, "blue" ) )
			bot->think = BOT_JoinBlue;
		else if( !Q_stricmp( team, "red" ) )
			bot->think = BOT_JoinRed;
	}
	
	AI_EnemyAdded (bot); // let the ai know we added another
}
예제 #2
0
파일: bot_spawn.c 프로젝트: zardoru/vrxcl
///////////////////////////////////////////////////////////////////////
// Respawn the bot
///////////////////////////////////////////////////////////////////////
void BOT_Respawn (edict_t *self)
{
	CopyToBodyQue (self);

	PutClientInServer (self);

	// add a teleportation effect
	self->s.event = EV_PLAYER_TELEPORT;

		// hold in place briefly
	self->client->ps.pmove.pm_flags = PMF_TIME_TELEPORT;
	self->client->ps.pmove.pm_time = 14;

	self->client->respawn_time = level.time;

	AI_ResetWeights(self);
	AI_ResetNavigation(self);
}
예제 #3
0
//==========================================
// BOT_Respawn
// Set up bot for Spawn. Called at first spawn & each respawn
//==========================================
void BOT_Respawn( edict_t *self )
{
	if( self->ai.type != AI_ISBOT )
		return;

	self->enemy = NULL;
	self->movetarget = NULL;

	self->ai.statusUpdateTimeout = 0;
	self->ai.changeweapon_timeout = 0;
	self->ai.combatmovepush_timeout = 0;
	self->ai.state_combat_timeout = 0;
	self->ai.enemyReactionDelay = 0;

	VectorClear( self->r.client->ps.pmove.delta_angles );

	AI_ResetNavigation( self );
}
예제 #4
0
void M_default_Start( edict_t *self )
{
	self->health = 30;
	self->max_health = self->health;
	self->item = FindItemByClassname("ammo_bullets");


	self->think = AI_Think;
	self->nextthink = level.time + FRAMETIME;
	self->yaw_speed = 100;
	M_default_InitPersistant(self);
	AI_ResetNavigation(self);

	//add as bot enemy
	AI_EnemyAdded( self );

	//if(AIDevel.debugMode && bot_debugmonster->integer)
		Com_Printf ("monster: Spawn\n");
}
예제 #5
0
//==========================================
// BOT_Respawn
// Set up bot for Spawn. Called at first spawn & each respawn
//==========================================
void BOT_Respawn( edict_t *self )
{
	if( AI_GetType( self->ai ) != AI_ISBOT )
		return;

	self->enemy = NULL;
	self->movetarget = NULL;
	self->pain = BOT_pain;

	self->ai->statusUpdateTimeout = 0;
	self->ai->changeweapon_timeout = 0;
	self->ai->combatmovepush_timeout = 0;
	self->ai->state_combat_timeout = 0;
	self->ai->enemyReactionDelay = 0;
	self->ai->last_attacker = NULL;

	VectorClear( self->r.client->ps.pmove.delta_angles );
	self->r.client->level.last_activity = level.time;

	AI_ResetNavigation( self );
}