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.

82 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Upgrade that damages the object over time
  4. //
  5. //=============================================================================//
  6. #ifndef TF_OBJ_SAPPER_H
  7. #define TF_OBJ_SAPPER_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tf_obj_baseupgrade_shared.h"
  12. #define SAPPER_MAX_HEALTH 100
  13. enum SapperModel_t
  14. {
  15. SAPPER_MODEL_PLACED,
  16. SAPPER_MODEL_PLACEMENT,
  17. SAPPER_MODEL_TOTAL
  18. };
  19. // ------------------------------------------------------------------------ //
  20. // Sapper upgrade
  21. // ------------------------------------------------------------------------ //
  22. class CObjectSapper : public CBaseObjectUpgrade
  23. {
  24. DECLARE_CLASS( CObjectSapper, CBaseObjectUpgrade );
  25. public:
  26. DECLARE_DATADESC();
  27. DECLARE_SERVERCLASS();
  28. CObjectSapper();
  29. virtual void Spawn();
  30. virtual void Precache();
  31. void Precache( const char *pchBaseModel );
  32. virtual bool IsHostileUpgrade( void ) { return true; }
  33. virtual void FinishedBuilding( void );
  34. virtual void SetupAttachedVersion( void );
  35. virtual void DetachObjectFromObject( void );
  36. virtual void UpdateOnRemove( void );
  37. virtual void OnGoActive( void );
  38. bool IsParentValid( void );
  39. const char* GetSapperModelName( SapperModel_t nModel, const char *pchModelName = NULL );
  40. const char* GetSapperSoundName( void );
  41. virtual void SapperThink( void );
  42. virtual int OnTakeDamage( const CTakeDamageInfo &info );
  43. virtual void Killed( const CTakeDamageInfo &info );
  44. virtual int GetBaseHealth( void );
  45. void ApplyRoboSapper( CTFPlayer *pTarget, float flDuration, int nRadius = 200 );
  46. bool ApplyRoboSapperEffects( CTFPlayer *pTarget, float flDuration );
  47. bool IsValidRoboSapperTarget( CTFPlayer *pTarget );
  48. float GetReversesBuildingConstructionSpeed( void );
  49. private:
  50. float m_flSapperDamageAccumulator;
  51. float m_flLastThinkTime;
  52. float m_flLastHealthLeachTime;
  53. float m_flSelfDestructTime;
  54. float m_flSapperStartTime;
  55. char m_szSapperModel[ _MAX_PATH ];
  56. char m_szPlacementModel[ _MAX_PATH ];
  57. char szSapperSound[ _MAX_PATH ];
  58. #ifdef STAGING_ONLY
  59. bool m_bIsRinging;
  60. #endif
  61. };
  62. #endif // TF_OBJ_SAPPER_H