summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_drainbeam.h
blob: 61239ce88e27f48da0ece691a4d1d4cafe81a9bd (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include "weapon_combat_usedwithshieldbase.h"

#if defined( CLIENT_DLL )
#define CWeaponDrainBeam C_WeaponDrainBeam
#endif

//=========================================================
// Medikit Weapon
//=========================================================
class CWeaponDrainBeam : public CWeaponCombatUsedWithShieldBase
{
	DECLARE_CLASS( CWeaponDrainBeam, CWeaponCombatUsedWithShieldBase );
public:
	DECLARE_NETWORKCLASS();
	DECLARE_PREDICTABLE();

	CWeaponDrainBeam( void );

	virtual void	Precache();

	virtual bool	Holster( CBaseCombatWeapon *pSwitchingTo );
	virtual void	ItemPostFrame( void );
	virtual void	PrimaryAttack( void );
	virtual void	WeaponIdle( void );

	virtual void	PlayAttackAnimation( int activity );
	virtual void	GainedNewTechnology( CBaseTechnology *pTechnology );

	// Draining
	CBaseEntity		*GetTargetToDrain( CBaseEntity *pCurDrainTarget );
	CBaseEntity		*GetCurDrainTarget( void )	{ return m_hDrainTarget; }
	void			RemoveDrainTarget( void );

	// All predicted weapons need to implement and return true
	virtual bool			IsPredicted( void ) const
	{ 
		return true;
	}

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

		return BaseClass::ShouldPredict();
	}
	// Stop all sounds being output.
	void			StopDrainSound( bool bStopHealingSound = true, bool bStopNoTargetSound = true );
// IClientNetworkable.
public:
	virtual void	OnDataChanged( DataUpdateType_t updateType );
// IClientThinkable.
public:

	virtual void	ClientThink();

#endif

public:
	CNetworkHandle( CBaseEntity, m_hDrainTarget );

// Networked data.
public:
	CNetworkVar( bool, m_bDraining );
	CNetworkVar( bool, m_bAttacking );
	CNetworkVector( m_vFireTarget );

#if defined( CLIENT_DLL )
	CSmartPtr<CSimpleEmitter> m_pEmitter;
	PMaterialHandle			m_hParticleMaterial;

	TimedEvent				m_PathParticleEvent;
	TimedEvent				m_DribbleParticleEvent;

	bool					m_bPlayingSound;
#else
	float					m_flDrainStartedAt;
#endif
private:
	double					m_flNextBuzzTime;
	
	CWeaponDrainBeam( const CWeaponDrainBeam & );
};

#endif // WEAPON_DRAINBEAM_H