summaryrefslogtreecommitdiff
path: root/game/server/tf2/info_output_team.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/tf2/info_output_team.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/tf2/info_output_team.cpp')
-rw-r--r--game/server/tf2/info_output_team.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/game/server/tf2/info_output_team.cpp b/game/server/tf2/info_output_team.cpp
new file mode 100644
index 0000000..ffe3f97
--- /dev/null
+++ b/game/server/tf2/info_output_team.cpp
@@ -0,0 +1,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 );
+ }
+ }
+ }
+} \ No newline at end of file