Ejemplo n.º 1
0
/*
* G_Match_ToggleReady
*/
void G_Match_ToggleReady( edict_t *ent )
{
	if( !level.ready[PLAYERNUM( ent )] )
		G_Match_Ready( ent );
	else
		G_Match_NotReady( ent );
}
Ejemplo n.º 2
0
void Bot::ActiveFrame()
{
    //get ready if in the game
    if(GS_MatchState() <= MATCH_STATE_WARMUP && !IsReady() && self->r.client->teamstate.timeStamp + 4000 < level.time)
        G_Match_Ready(self);

    ApplyPendingTurnToLookAtPoint();

    const CombatTask &combatTask = botBrain.combatTask;

    bool inhibitShooting, inhibitCombatMove;
    SetCombatInhibitionFlags(&inhibitShooting, &inhibitCombatMove);

    // ucmd modification in FireWeapon() will be overwritten by MoveFrame()
    bool fireButtonPressed = false;
    if (!inhibitShooting)
    {
        SetCloakEnabled(false);
        // If bot fired builtin or script weapon, save builtin fire button status
        FireWeapon(&fireButtonPressed);
    }
    else
    {
        if (!combatTask.Empty())
        {
            SetCloakEnabled(true);
        }
        else if (botBrain.HasGoal())
        {
            if (botBrain.IsCloseToAnyGoal(768.0f, true))
                SetCloakEnabled(true);
            else if (botBrain.IsCloseToAnyGoal(384.0f, false))
                SetCloakEnabled(true);
            else
                SetCloakEnabled(false);
        }
        else
        {
            SetCloakEnabled(false);
        }
    }

    bool beSilent = ShouldBeSilent(inhibitShooting);

    // Do not modify pmove features by beSilent value, features may be changed dynamically by script.
    usercmd_t ucmd;
    memset(&ucmd, 0, sizeof(ucmd));
    MoveFrame(&ucmd, inhibitCombatMove, beSilent);

    if (fireButtonPressed)
        ucmd.buttons |= BUTTON_ATTACK;

    CallActiveClientThink(&ucmd);

    SayVoiceMessages();
}
Ejemplo n.º 3
0
void G_Teams_Coach( edict_t *ent )
{
	if( GS_TeamBasedGametype() && !GS_InvidualGameType() && ent->s.team != TEAM_SPECTATOR )
	{
		if( !teamlist[ent->s.team].has_coach )
		{
			if( GS_MatchState() > MATCH_STATE_WARMUP && !GS_MatchPaused() )
			{
				G_PrintMsg( ent, "Can't set coach mode with the match in progress\n" );
			}
			else
			{
				// move to coach mode
				ent->r.client->teamstate.is_coach = true;
				G_GhostClient( ent );
				ent->health = ent->max_health;
				ent->deadflag = DEAD_NO;

				G_ChasePlayer( ent, NULL, true, 0 );

				//clear up his scores
				G_Match_Ready( ent ); // set ready and check readys
				memset( &ent->r.client->level.stats, 0, sizeof( ent->r.client->level.stats ) );

				teamlist[ent->s.team].has_coach = true;
				G_PrintMsg( NULL, "%s%s is now team %s coach \n", ent->r.client->netname,
					S_COLOR_WHITE, GS_TeamName( ent->s.team ) );
			}
		}
		else if( ent->r.client->teamstate.is_coach )
		{                            // if you are this team coach, resign
			ent->r.client->teamstate.is_coach = false;
			G_PrintMsg( NULL, "%s%s is no longer team %s coach \n", ent->r.client->netname,
				S_COLOR_WHITE, GS_TeamName( ent->s.team ) );

			G_Teams_SetTeam( ent, ent->s.team );
		}
		else
			G_PrintMsg( ent, "Your team already has a coach.\n" );
	}
	else
		G_PrintMsg( ent, "Coaching only valid while on a team in Team based Gametypes.\n" );
}
Ejemplo n.º 4
0
//==========================================
// BOT_DMclass_RunFrame
// States Machine & call client movement
//==========================================
static void BOT_DMclass_RunFrame( edict_t *self )
{
	usercmd_t ucmd;
	float weapon_quality;
	bool inhibitCombat = false;
	int i;

	if( G_ISGHOSTING( self ) )
	{
		BOT_DMclass_GhostingFrame( self );
		return;
	}

	memset( &ucmd, 0, sizeof( ucmd ) );

	//get ready if in the game
	if( GS_MatchState() <= MATCH_STATE_WARMUP && !level.ready[PLAYERNUM(self)]
	&& self->r.client->teamstate.timeStamp + 4000 < level.time )
		G_Match_Ready( self );

	if( level.gametype.dummyBots || bot_dummy->integer )
	{
		self->r.client->level.last_activity = level.time;
	}
	else
	{
		BOT_DMclass_FindEnemy( self );

		weapon_quality = BOT_DMclass_ChooseWeapon( self );

		inhibitCombat = ( AI_CurrentLinkType( self ) & (LINK_JUMPPAD|LINK_JUMP|LINK_ROCKETJUMP) ) != 0 ? true : false;

		if( self->enemy && weapon_quality >= 0.3 && !inhibitCombat ) // don't fight with bad weapons
		{
			if( BOT_DMclass_FireWeapon( self, &ucmd ) )
				self->ai->state_combat_timeout = level.time + AI_COMBATMOVE_TIMEOUT;
		}

		if( inhibitCombat )
			self->ai->state_combat_timeout = 0;

		if( self->ai->state_combat_timeout > level.time )
		{
			BOT_DMclass_CombatMovement( self, &ucmd );
		}
		else
		{
			BOT_DMclass_Move( self, &ucmd );
		}

		//set up for pmove
		for( i = 0; i < 3; i++ )
			ucmd.angles[i] = ANGLE2SHORT( self->s.angles[i] ) - self->r.client->ps.pmove.delta_angles[i];

		VectorSet( self->r.client->ps.pmove.delta_angles, 0, 0, 0 );
	}

	// set approximate ping and show values
	ucmd.msec = game.frametime;
	ucmd.serverTimeStamp = game.serverTime;

	ClientThink( self, &ucmd, 0 );
	self->nextThink = level.time + 1;

	BOT_DMclass_VSAYmessages( self );
}