summaryrefslogtreecommitdiff
path: root/game/server/tf2/tf_func_mass_teleport.h
blob: c9d178cb1df7d9a5f23824df426759741abf7be3 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: An trigger that teleports its contents to a target when triggered.
//
// $NoKeywords: $
//=============================================================================//

#ifndef TF_FUNC_MASS_TELEPORT_H
#define TF_FUNC_MASS_TELEPORT_H

#ifdef _WIN32
#pragma once
#endif

class CBaseObject;
class Vector;
class CTFTeam;
class CVehicleTeleportStation;

//-----------------------------------------------------------------------------
// Purpose: Defines an area from which resources can be collected
//-----------------------------------------------------------------------------
class CFuncMassTeleport : public CBaseEntity
{
	DECLARE_CLASS( CFuncMassTeleport, CBaseEntity );
public:
	CFuncMassTeleport();

	DECLARE_DATADESC();

	virtual void Spawn( void );
	virtual void Precache( void );
	virtual void Activate(void);

	void	DoTeleport( CTFTeam *pTeam, Vector vSourceMins, Vector vSourceMaxs, Vector vDest, bool bSwap, bool bPlayersOnly, EHANDLE hMCV );

	// Inputs
	void	InputDoTeleport( inputdata_t &inputdata );

	bool	PointIsWithin( const Vector &vecPoint );

	// need to transmit to players who are in commander mode
	int		UpdateTransmitState() { return SetTransmitState( FL_EDICT_FULLCHECK); }
	int 	ShouldTransmit( const CCheckTransmitInfo *pInfo );

	// Return true if this teleport's for use by MCVs in the field
	bool	IsMCVTeleport( void ) { return m_bMCV; }
	void	AddMCV( CBaseEntity *pMCV );
	void	RemoveMCV( CBaseEntity *pMCV );

private:

	void MassTeleport( CTFTeam *pTeam, Vector vSourceMins, Vector vSourceMaxs, Vector vDest, bool bSwap, bool bPlayersOnly, EHANDLE hMCV, bool bTelefragDestination );
	void MassTelefrag( Vector vMins, Vector vMaxs );


	// Entity to teleport to.
	EHANDLE		m_hTargetEntity;		

	// If true, this teleport's designed to teleport players to MCVs in the field
	bool		m_bMCV;
	typedef CHandle<CVehicleTeleportStation> hMCVHandle;
	CUtlVector<hMCVHandle> m_MCVs;

	// Outputs
	COutputEvent m_OnTeleport;
	COutputEvent m_OnActive;
	COutputEvent m_OnInactive;
};


#endif // TF_FUNC_MASS_TELEPORT_H