//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CTFBaseRocket *CTFBaseRocket::Create( const char *pszClassname, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner ) { CTFBaseRocket *pRocket = static_cast<CTFBaseRocket*>( CBaseEntity::Create( pszClassname, vecOrigin, vecAngles, pOwner ) ); if ( !pRocket ) return NULL; // Initialize the owner. pRocket->SetOwnerEntity( pOwner ); // Spawn. pRocket->Spawn(); // Setup the initial velocity. Vector vecForward, vecRight, vecUp; AngleVectors( vecAngles, &vecForward, &vecRight, &vecUp ); Vector vecVelocity = vecForward * 1100.0f; pRocket->SetAbsVelocity( vecVelocity ); pRocket->SetupInitialTransmittedGrenadeVelocity( vecVelocity ); // Setup the initial angles. QAngle angles; VectorAngles( vecVelocity, angles ); pRocket->SetAbsAngles( angles ); // Set team. pRocket->ChangeTeam( pOwner->GetTeamNumber() ); return pRocket; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CTFBaseRocket *CTFBaseRocket::Create( CBaseEntity *pWeapon, const char *pszClassname, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner ) { CTFBaseRocket *pRocket = static_cast<CTFBaseRocket*>( CBaseEntity::CreateNoSpawn( pszClassname, vecOrigin, vecAngles, pOwner ) ); if ( !pRocket ) return NULL; // Set firing weapon. pRocket->SetLauncher( pWeapon ); // Spawn. DispatchSpawn( pRocket ); float flGravity = 0.0f; CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pWeapon, flGravity, mod_rocket_gravity ); if ( flGravity ) { pRocket->SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_CUSTOM ); pRocket->SetGravity( flGravity ); } // Setup the initial velocity. Vector vecForward, vecRight, vecUp; AngleVectors( vecAngles, &vecForward, &vecRight, &vecUp ); float flVelocity = 1100.0f; CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pWeapon, flVelocity, mult_projectile_speed ); Vector vecVelocity = vecForward * flVelocity; pRocket->SetAbsVelocity( vecVelocity ); pRocket->SetupInitialTransmittedGrenadeVelocity( vecVelocity ); // Setup the initial angles. QAngle angles; VectorAngles( vecVelocity, angles ); pRocket->SetAbsAngles( angles ); // Set team. pRocket->ChangeTeam( pOwner->GetTeamNumber() ); return pRocket; }