Esempio n. 1
0
void AvHCocoon::FireProjectiles(void)
{
#ifdef AVH_SERVER
	
	// Make sure we have enough points to shoot this thing
	AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(this->m_pPlayer);
	ASSERT(thePlayer);
	
	vec3_t theNewPoint = this->pev->origin;
	TraceResult	tr;
	
	// Do a traceline to see who to cocoon
	UTIL_MakeVectors(this->pev->angles);

	Vector theForwardDir = (gpGlobals->v_forward + gpGlobals->v_right + gpGlobals->v_up);
	UTIL_TraceLine(this->pev->origin + this->pev->view_ofs, this->pev->origin + this->pev->view_ofs + theForwardDir*128, dont_ignore_monsters, ENT(this->m_pPlayer->pev), &tr);
	if(tr.flFraction != 1.0)
	{
		CBaseEntity* theEntity = CBaseEntity::Instance(tr.pHit);
		if(theEntity)
		{
			AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theEntity);
			if(thePlayer /*&& (thePlayer->pev->team != this->pev->team)*/ && (thePlayer->GetRole() != ROLE_GESTATING) && (thePlayer->GetRole() != ROLE_COCOONED))
			{
				GetGameRules()->MarkDramaticEvent(kCocoonPriority, thePlayer, this->m_pPlayer);

				// Play successful cocoon sound!
				EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, kCocoonSound2, 1.0, ATTN_NORM, 0, 100 + RANDOM_LONG(-3,3) );
				
				// Yes!
				thePlayer->StartCocooning();
			}
		}
	}
				
	#endif	
}