aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/hl2/grenade_tripwire.h
blob: 1da7c92d2b73fd08c74df70ee80e3065b397436f (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:		Tripmine
//
// $Workfile:     $
// $Date:         $
// $NoKeywords: $
//=============================================================================//

#ifndef	TRIPWIRE_H
#define	TRIPWIRE_H

#ifdef _WIN32
#pragma once
#endif

#include "basegrenade_shared.h"

class CRopeKeyframe;

// ####################################################################
//   CTripwireHook
//
//		This is what the tripwire shoots out at the end of the rope
// ####################################################################
class CTripwireHook : public CBaseAnimating
{
	DECLARE_DATADESC();
public:
	DECLARE_CLASS( CTripwireHook, CBaseAnimating );

	EHANDLE m_hGrenade;
	bool	m_bAttached;

	void Spawn( void );
	void Precache( void );
	bool CreateVPhysics( void );
	void EndTouch( CBaseEntity *pOther );
	void SetVelocity( const Vector &velocity, const AngularImpulse &angVelocity );
};

class CTripwireGrenade : public CBaseGrenade
{
public:
	DECLARE_CLASS( CTripwireGrenade, CBaseGrenade );

	CTripwireGrenade();
	void Spawn( void );
	void Precache( void );

	int OnTakeDamage_Alive( const CTakeDamageInfo &info );
	
	void WarningThink( void );
	void PowerupThink( void );
	void RopeBreakThink( void );
	void FireThink( void );
	void Event_Killed( const CTakeDamageInfo &info );
	void Attach( void );

	void MakeRope( void );
	void BreakRope( void );
	void ShakeRope( void );
	void FireMissile(const Vector &vTargetPos);

private:
	float			m_flPowerUp;
	Vector			m_vecDir;

	int				m_nMissileCount;

	Vector			m_vTargetPos;
	Vector			m_vTargetOffset;

	CRopeKeyframe*	m_pRope;
	CTripwireHook*  m_pHook;

	DECLARE_DATADESC();
};

#endif	//TRIPWIRE_H