blob: ffe3f973e698ca500d24425aade9062c776fe303 (
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
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "cbase.h"
#include "EntityOutput.h"
#include "EntityList.h"
#include "tf_team.h"
#include "baseentity.h"
//-----------------------------------------------------------------------------
// Purpose: Map entity that fires its output with all the players in a team
//-----------------------------------------------------------------------------
class CInfoOutputTeam : public CBaseEntity
{
DECLARE_CLASS( CInfoOutputTeam, CBaseEntity );
public:
DECLARE_DATADESC();
void Spawn( void );
// Inputs
void InputFire( inputdata_t &inputdata );
public:
// Outputs
COutputEHANDLE m_Player;
};
BEGIN_DATADESC( CInfoOutputTeam )
// inputs
DEFINE_INPUTFUNC( FIELD_VOID, "Fire", InputFire ),
// outputs
DEFINE_OUTPUT( m_Player, "Player" ),
END_DATADESC()
LINK_ENTITY_TO_CLASS( info_output_team, CInfoOutputTeam );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CInfoOutputTeam::Spawn( void )
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CInfoOutputTeam::InputFire( inputdata_t &inputdata )
{
// Loop through all the players on the team and fire our output with each of them.
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( UTIL_PlayerByIndex(i) );
if ( pPlayer )
{
// If we don't belong to a team, loop through all players
if ( GetTeamNumber() == 0 || pPlayer->GetTeamNumber() == GetTeamNumber() )
{
EHANDLE hHandle;
hHandle = pPlayer;
m_Player.Set( hHandle, inputdata.pActivator, this );
}
}
}
}
|