Beispiel #1
0
//=========================================================
void CQuakeRocket::GrenadeExplode()
{
	CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner);
	Q_RadiusDamage(this, pOwner, 120, NULL);

	// Finish and remove
	Explode();
}
Beispiel #2
0
//=========================================================
void CQuakeRocket::RocketTouch ( CBaseEntity *pOther )
{
	// Remove if we've hit skybrush
	if ( UTIL_PointContents(pev->origin) == CONTENT_SKY )
	{
		UTIL_Remove( this );
		return;
	}

	// Do touch damage
	float flDmg = RANDOM_FLOAT( 100, 120 );
	CBaseEntity *pOwner = CBaseEntity::Instance(pev->owner);
	if (pOther->pev->health)
		pOther->TakeDamage( pev, pOwner->pev, flDmg, DMG_BULLET );

	// Don't do radius damage to the other, because all the damage was done in the impact
	Q_RadiusDamage(this, pOwner, 120, pOther);

	// Finish and remove
	Explode();
}
// Lightning Gun
void CBasePlayer::W_FireLightning(int iQuadSound)
{
	if(*m_pCurrentAmmo < 1)
	{
		//This should already be IT_LIGHTNING but what the heck.
		if(m_iQuakeWeapon == IT_LIGHTNING)
		{
			PLAYBACK_EVENT_FULL(FEV_NOTHOST, edict(), m_usLightning, 0, (float *)&pev->origin, (float *)&pev->angles, 0.0, 0.0, 0, 1, 0, 0);

			if(m_pActiveItem)
				((CQuakeGun *)m_pActiveItem)->DestroyEffect();
		}

		m_iQuakeWeapon = W_BestWeapon();
		W_SetCurrentAmmo();
		return;
	}

	bool playsound = false;

	// Make lightning sound every 0.6 seconds
	if(m_flLightningTime <= gpGlobals->time)
	{
		playsound         = true;
		m_flLightningTime = gpGlobals->time + 0.6;
	}

	// explode if under water
	if(pev->waterlevel > 1)
	{
		if((gpGlobals->deathmatch > 3) && (RANDOM_FLOAT(0, 1) <= 0.5))
		{
			strcpy(gszQ_DeathType, "selfwater");
			TakeDamage(pev, pev, 4000, DMG_GENERIC);
		}
		else
		{
			float flCellsBurnt = *m_pCurrentAmmo;
			*m_pCurrentAmmo    = 0;
			W_SetCurrentAmmo();
#if !defined(CLIENT_DLL)
			Q_RadiusDamage(this, this, 35 * flCellsBurnt, NULL);
#endif
			return;
		}
	}

	PLAYBACK_EVENT_FULL(FEV_NOTHOST, edict(), m_usLightning, 0, (float *)&pev->origin, (float *)&pev->angles, 0.0, 0.0, iQuadSound, 0, playsound, 0);

#if !defined(CLIENT_DLL)

	if(gpGlobals->deathmatch != 4)
		*m_pCurrentAmmo -= 1;

	// Lightning bolt effect
	TraceResult trace;
	Vector      vecOrg = pev->origin + Vector(0, 0, 16);
	UTIL_MakeVectors(pev->v_angle);
	UTIL_TraceLine(vecOrg, vecOrg + (gpGlobals->v_forward * 600), ignore_monsters, ENT(pev), &trace);

	Vector vecDir = gpGlobals->v_forward + (0.001 * gpGlobals->v_right) + (0.001 * gpGlobals->v_up);
	// Do damage
	LightningDamage(pev->origin, trace.vecEndPos + (gpGlobals->v_forward * 4), this, 30, vecDir);

#endif
}