summaryrefslogtreecommitdiff
path: root/game/server/tf/tf_projectile_flare.h
blob: 2a55c145753f087d1161e9d09ed7997a48b23ec2 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// TF Flare Projectile
//
//=============================================================================
#ifndef TF_PROJECTILE_FLARE_H
#define TF_PROJECTILE_FLARE_H
#ifdef _WIN32
#pragma once
#endif

#include "tf_weaponbase_rocket.h"
#include "iscorer.h"

// Base force scaler
#define TF_FLARE_PELLET_FORCE 20.0f

// The farther the pellet flies, the more force it does up to a max of 4X at 1 second
#define TF_FLARE_PELLET_FORCE_DISTANCE_SCALE 3.75f

// We need this to get the player off the ground
#define TF_FLARE_PELLET_FORCE_UPWARD 275

// We need this to get the heavy off the ground
#define TF_FLARE_PELLET_FORCE_UPWARD_HEAVY 525


class CTFProjectile_Flare : public CTFBaseRocket, public IScorer
{
public:

	DECLARE_CLASS( CTFProjectile_Flare, CTFBaseRocket );
	DECLARE_NETWORKCLASS();
	DECLARE_DATADESC();

	CTFProjectile_Flare();
	~CTFProjectile_Flare();

	// Creation.
	static CTFProjectile_Flare *Create( CBaseEntity *pLauncher, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity *pOwner = NULL, CBaseEntity *pScorer = NULL );	
	virtual void	Spawn();
	virtual void	Precache();
	virtual int		GetWeaponID( void ) const			{ return TF_WEAPON_FLAREGUN; }

	virtual void	Explode( trace_t *pTrace, CBaseEntity *pOther );
	void			Explode_Air( trace_t *pTrace, int bitsDamageType, bool bSelfOnly = false );
	void			Detonate( bool bSelfOnly = false );
	virtual float	GetRadius( void );
	void			SendDeathNotice( void );

	float			GetTimeAlive( void ) const { return gpGlobals->curtime - m_flCreationTime; }
	bool			IsFromTaunt( void ) const { return m_bIsFromTaunt; }

	void			ImpactThink( void );

	// Implement this if you use MOVETYPE_CUSTOM
	virtual void	PerformCustomPhysics( Vector *pNewPosition, Vector *pNewVelocity, QAngle *pNewAngles, QAngle *pNewAngVelocity );

	// IScorer interface
	virtual CBasePlayer *GetScorer( void );
	virtual CBasePlayer *GetAssistant( void ) { return NULL; }

	void	SetScorer( CBaseEntity *pScorer );

	void	SetCritical( bool bCritical ) { m_bCritical = bCritical; }
	virtual int		GetDamageType();

	virtual bool	IsDeflectable() { return true; }
	virtual void	Deflected( CBaseEntity *pDeflectedBy, Vector &vecDir );
	virtual bool	IsDestroyable( void ) OVERRIDE { return false; }

	float GetProjectileSpeed( void ) const;
	float GetHeatSeekPower( void ) const;

private:

	CBaseHandle m_Scorer;

	bool		m_bIsFromTaunt;
	float		m_flCreationTime;
	float		m_flImpactTime;
	Vector		m_vecImpactNormal;

	CNetworkVar( bool, m_bCritical );

	bool		m_bImpact;

	float		m_flNextSeekUpdate;
};

#endif	//TF_PROJECTILE_FLARE_H