summaryrefslogtreecommitdiff
path: root/game/server/tf2/gasoline_blob.h
blob: 5c3b303b562163d30fe831a1152db8a00c128666 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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


#include "baseentity.h"


class CGasolineBlob : public CBaseEntity
{
public:
	DECLARE_CLASS( CGasolineBlob, CBaseEntity );
	DECLARE_SERVERCLASS();


	// Create a gasoline blob.
	// flAirLifetime specifies how long it takes to fizzle out in the air.
	static CGasolineBlob*	Create( 
		CBaseEntity *pOwner, 
		const Vector &vOrigin, 
		const Vector &vStartVelocity, 
		bool bUseGravity,
		float flAirLifetime,
		float flLifetime );

	virtual					~CGasolineBlob();

	// A lit blob will always apply at least 25% damage to its "auto burn" blob.
	//
	// This is used when laying down gasoline blobs in a line. Since it's fairly easy to accidentally
	// lay down blobs that won't damage each other because they're too far away, the line of blobs
	// can be linked together using this.
	void			AddAutoBurnBlob( CGasolineBlob *pBlob );


// Overrides.
public:

	virtual int		OnTakeDamage( const CTakeDamageInfo &info );



// Implementation.
public:
	
	bool	IsLit() const;
	bool	IsStopped() const;
	void	SetLit( bool bLit );

	void	Think();

	void	AutoBurn_R( CGasolineBlob *pParent );


private:
	
	typedef CHandle<CGasolineBlob> CGasolineBlobHandle;
	CUtlVector<CGasolineBlobHandle>	m_AutoBurnBlobs;
	
	float			m_flTimeInAir;		// How long we've been in the air.
	float			m_flAirLifetime;	// How long we're allowed to exist in the air.

	CNetworkVar( float, m_flLitStartTime );	// What time did the blob become lit at?
	
	CNetworkVar( int, m_BlobFlags );	// Combination of BLOBFLAG_ defines.
	
	// This is set at the start and is used to know the percentage of lifetime left.
	CNetworkVar( float, m_flMaxLifetime );

	// When the blob was created.
	CNetworkVar( float, m_flCreateTime );

	CNetworkVector( m_vSurfaceNormal );	// This is sent to the client so it can spread the fire out.

	EHANDLE			m_hOwner;
	float			m_HeatLevel;	// This rises when other flames are nearby until we ignite.
};


// Returns true if the entity is a gasoline blob.
bool IsGasolineBlob( CBaseEntity *pEnt );


#endif // GASOLINE_BLOB_H