Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: The TF Game rules object
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef SDK_GAMERULES_H
  10. #define SDK_GAMERULES_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "teamplay_gamerules.h"
  15. #include "convar.h"
  16. #include "gamevars_shared.h"
  17. #ifdef CLIENT_DLL
  18. #include "c_baseplayer.h"
  19. #else
  20. #include "player.h"
  21. #endif
  22. #ifdef CLIENT_DLL
  23. #define CSDKGameRules C_SDKGameRules
  24. #define CSDKGameRulesProxy C_SDKGameRulesProxy
  25. #endif
  26. class CSDKGameRulesProxy : public CGameRulesProxy
  27. {
  28. public:
  29. DECLARE_CLASS( CSDKGameRulesProxy, CGameRulesProxy );
  30. DECLARE_NETWORKCLASS();
  31. };
  32. class CSDKGameRules : public CTeamplayRules
  33. {
  34. public:
  35. DECLARE_CLASS( CSDKGameRules, CTeamplayRules );
  36. virtual bool ShouldCollide( int collisionGroup0, int collisionGroup1 );
  37. virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
  38. virtual bool IsTeamplay( void ) { return false; }
  39. #ifdef CLIENT_DLL
  40. DECLARE_CLIENTCLASS_NOBASE(); // This makes datatables able to access our private vars.
  41. #else
  42. DECLARE_SERVERCLASS_NOBASE(); // This makes datatables able to access our private vars.
  43. CSDKGameRules();
  44. virtual ~CSDKGameRules();
  45. virtual bool ClientCommand( CBaseEntity *pEdict, const CCommand &args );
  46. virtual void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrcIn, float flRadius, int iClassIgnore );
  47. virtual void Think();
  48. virtual const char *GetChatPrefix( bool bTeamOnly, CBasePlayer *pPlayer );
  49. private:
  50. void RadiusDamage( const CTakeDamageInfo &info, const Vector &vecSrcIn, float flRadius, int iClassIgnore, bool bIgnoreWorld );
  51. #endif
  52. };
  53. //-----------------------------------------------------------------------------
  54. // Gets us at the team fortress game rules
  55. //-----------------------------------------------------------------------------
  56. inline CSDKGameRules* SDKGameRules()
  57. {
  58. return static_cast<CSDKGameRules*>(g_pGameRules);
  59. }
  60. #endif // SDK_GAMERULES_H