예제 #1
0
void StatsReport::OnThink()
{
	int nMarine = 0;

	m_pObjectiveMap->ClearBlips();

	C_ASW_Game_Resource *pGameResource = ASWGameResource();

	for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
		if ( pMR )
		{
			Vector vPos;
			vPos.x = pMR->m_TimelinePosX.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.y = pMR->m_TimelinePosY.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
			vPos.z = 0.0f;

			bool bDead = ( pMR->m_TimelineHealth.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp ) <= 0.0f );
			
			m_pObjectiveMap->AddBlip( MapBlip_t( vPos, bDead ? Color( 255, 255, 255, 255 ) : getColorPerIndex(pMR->GetCommanderIndex()), bDead ? MAP_BLIP_TEXTURE_DEATH : MAP_BLIP_TEXTURE_NORMAL ) );

			if ( m_pReadyCheckImages[ nMarine ]->IsVisible() )
			{
				C_ASW_Player *pPlayer = pMR->GetCommander();
				if ( pPlayer )
				{
					if ( !pMR->IsInhabited() || ASWGameResource()->IsPlayerReady( pPlayer ) )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxTicked" );
					}
					else if ( pPlayer == ASWGameResource()->GetLeader() )
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/PlayerList/LeaderIcon" );
					}
					else
					{
						m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxEmpty" );
					}
				}
			}

			nMarine++;
		}
	}

	for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
	{
		
	}
}
void CASW_Grenade_PRifle::Detonate()
{
	if ( !ASWGameResource() )
		return;

	m_takedamage	= DAMAGE_NO;	

	CPASFilter filter( GetAbsOrigin() );
						
	Vector vecForward = GetAbsVelocity();
	VectorNormalize(vecForward);
	trace_t		tr;

	Vector vecDir = -vecForward;
	//te->GaussExplosion( filter, 0.0,
				//GetAbsOrigin(), vecDir, 0 );
	CEffectData data;
	data.m_vOrigin = GetAbsOrigin();
	DispatchEffect( "aswstunexplo", data );

	EmitSound("ASW_Weapon_PRifle.StunGrenadeExplosion");

	UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT, 
		this, COLLISION_GROUP_NONE, &tr);

	if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
	{
		// non-world needs smaller decals
		if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
		{
			UTIL_DecalTrace( &tr, "SmallScorch" );
		}
	}
	else
	{
		UTIL_DecalTrace( &tr, "Scorch" );
	}

	UTIL_ASW_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );

	int nPreviousStunnedAliens = ASWGameResource()->m_iElectroStunnedAliens;

	// do just 1 damage...
	CTakeDamageInfo info( this, GetOwnerEntity(), 1, DMG_SHOCK );
	info.SetWeapon( m_hCreatorWeapon );
	RadiusDamage ( info , GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );

	// count as a shot fired
	CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetOwnerEntity());
	if ( pMarine && pMarine->GetMarineResource() )
	{
		CASW_Marine_Resource *pMR = pMarine->GetMarineResource();
		pMR->UsedWeapon(NULL, 1);

		int nAliensStunned = ASWGameResource()->m_iElectroStunnedAliens - nPreviousStunnedAliens;
		if ( nAliensStunned >= 6 && pMR->IsInhabited() && pMR->GetCommander() )
		{
			 pMR->GetCommander()->AwardAchievement( ACHIEVEMENT_ASW_STUN_GRENADE );
			 pMR->m_bStunGrenadeMedal = true;
		}
	}

	UTIL_Remove( this );
}