summaryrefslogtreecommitdiff
path: root/game/shared/tf2/grenade_emp.h
blob: 3ee68a4b4ba144fc6da9f15e7c2f10d9ac90cb45 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef GRENADE_EMP_H
#define GRENADE_EMP_H
#ifdef _WIN32
#pragma once
#endif

class CSprite;

#include "grenade_base_empable.h"

#if defined( CLIENT_DLL )

#define CGrenadeEMP C_GrenadeEMP

#endif

//-----------------------------------------------------------------------------
// Purpose: EMP grenade
//-----------------------------------------------------------------------------
class CGrenadeEMP : public CBaseEMPableGrenade
{
	DECLARE_CLASS( CGrenadeEMP, CBaseEMPableGrenade );
public:
	CGrenadeEMP();

	DECLARE_PREDICTABLE();
	DECLARE_NETWORKCLASS();

	virtual void	Spawn( void );
	virtual void	Precache( void );
	virtual void	UpdateOnRemove( void );
	virtual void	Explode( trace_t *pTrace, int bitsDamageType );
	virtual void	BounceTouch( CBaseEntity *pOther );
	virtual void	BounceSound( void );
	virtual float	GetShakeAmplitude( void );
	virtual int		GetDamageType() const { return DMG_BLAST; }

	void	ApplyRadiusEMPEffect( CBaseEntity *pOwner, const Vector& vecCenter );
	
	static CGrenadeEMP *CGrenadeEMP::Create( const Vector &vecOrigin, const Vector &vecAngles, CBasePlayer *pOwner );

	// A derived class should return true here so that weapon sounds, etc, can
	//  apply the proper filter
	virtual bool			IsPredicted( void ) const
	{ 
		return true;
	}

#if defined( CLIENT_DLL )
	virtual bool	ShouldPredict( void )
	{
		if ( GetThrower() &&
			GetThrower() == C_BasePlayer::GetLocalPlayer() )
			return true;

		return BaseClass::ShouldPredict();
	}

	virtual void	OnDataChanged( DataUpdateType_t updateType );
	virtual void	ClientThink( void );

	TimedEvent		m_ParticleEvent;

	virtual int			DrawModel( int flags );

#endif

private:
	CNetworkHandle( CSprite, m_hLiveSprite );

private:
	CGrenadeEMP( const CGrenadeEMP & );
};

#endif // GRENADE_EMP_H