summaryrefslogtreecommitdiff
path: root/game/server/player_resource.h
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/player_resource.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/server/player_resource.h')
-rw-r--r--game/server/player_resource.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/game/server/player_resource.h b/game/server/player_resource.h
new file mode 100644
index 0000000..a22850a
--- /dev/null
+++ b/game/server/player_resource.h
@@ -0,0 +1,51 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Entity that propagates general data needed by clients for every player.
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef PLAYER_RESOURCE_H
+#define PLAYER_RESOURCE_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "shareddefs.h"
+
+class CPlayerResource : public CBaseEntity
+{
+ DECLARE_CLASS( CPlayerResource, CBaseEntity );
+public:
+ DECLARE_SERVERCLASS();
+ DECLARE_DATADESC();
+
+ virtual void Spawn( void );
+ virtual void Init( int iIndex );
+ virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() | FCAP_DONT_SAVE; }
+ virtual void ResourceThink( void );
+ virtual void UpdatePlayerData( void );
+ virtual int UpdateTransmitState( void );
+
+protected:
+ virtual void UpdateConnectedPlayer( int iIndex, CBasePlayer *pPlayer );
+ virtual void UpdateDisconnectedPlayer( int iIndex );
+
+ // Data for each player that's propagated to all clients
+ // Stored in individual arrays so they can be sent down via datatables
+ CNetworkArray( int, m_iPing, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_iScore, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_iDeaths, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_bConnected, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_iTeam, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_bAlive, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_iHealth, MAX_PLAYERS+1 );
+ CNetworkArray( uint32, m_iAccountID, MAX_PLAYERS+1 );
+ CNetworkArray( int, m_bValid, MAX_PLAYERS+1 );
+
+ int m_nUpdateCounter;
+};
+
+extern CPlayerResource *g_pPlayerResource;
+
+#endif // PLAYER_RESOURCE_H