summaryrefslogtreecommitdiff
path: root/game/server/dod/dod_smokegrenade_us.cpp
blob: 89ea682fdf060b85277a3550f015744bd4a4f6a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "dod_smokegrenade_us.h"

#define GRENADE_MODEL "models/Weapons/w_smoke_us.mdl"

LINK_ENTITY_TO_CLASS( grenade_smoke_us, CDODSmokeGrenadeUS );
PRECACHE_WEAPON_REGISTER( grenade_smoke_us );

CDODSmokeGrenadeUS* CDODSmokeGrenadeUS::Create( 
	const Vector &position, 
	const QAngle &angles, 
	const Vector &velocity, 
	const AngularImpulse &angVelocity, 
	CBaseCombatCharacter *pOwner )
{
	CDODSmokeGrenadeUS *pGrenade = (CDODSmokeGrenadeUS*)CBaseEntity::Create( "grenade_smoke_us", position, angles, pOwner );

	Assert( pGrenade );

	if( !pGrenade )
		return NULL;

	IPhysicsObject *pPhysicsObject = pGrenade->VPhysicsGetObject();
	if ( pPhysicsObject )
	{
		pPhysicsObject->AddVelocity( &velocity, &angVelocity );
	}

	// Who threw this grenade
	pGrenade->SetThrower( pOwner ); 

	pGrenade->ChangeTeam( pOwner->GetTeamNumber() );

	return pGrenade;
}

void CDODSmokeGrenadeUS::Spawn()
{
	SetModel( GRENADE_MODEL );
	BaseClass::Spawn();
}

void CDODSmokeGrenadeUS::Precache()
{
	PrecacheModel( GRENADE_MODEL );
	BaseClass::Precache();
}