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.

81 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // TF Energy Ring Projectile
  4. //
  5. //=============================================================================
  6. #ifndef TF_PROJECTILE_ENERGY_RING_H
  7. #define TF_PROJECTILE_ENERGY_RING_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #ifdef CLIENT_DLL
  12. #include "c_tf_player.h"
  13. #else
  14. #include "tf_player.h"
  15. #endif
  16. #include "tf_projectile_base.h"
  17. #include "tf_weapon_flamethrower.h"
  18. #ifdef CLIENT_DLL
  19. #define CTFProjectile_EnergyRing C_TFProjectile_EnergyRing
  20. #endif
  21. class CTFProjectile_EnergyRing : public CTFBaseProjectile
  22. {
  23. public:
  24. DECLARE_CLASS( CTFProjectile_EnergyRing, CTFBaseProjectile );
  25. DECLARE_NETWORKCLASS();
  26. CTFProjectile_EnergyRing();
  27. virtual const char* GetProjectileModelName( void );
  28. virtual float GetGravity( void );
  29. // Creation.
  30. static CTFProjectile_EnergyRing *Create( CTFWeaponBaseGun *pLauncher, const Vector& vecOrigin, const QAngle& vecAngles, float fSpeed, float fGravity, CBaseEntity *pOwner = NULL, CBaseEntity *pScorer = NULL, Vector vColor1=vec3_origin, Vector vColor2=vec3_origin, bool bCritical=false );
  31. virtual void Spawn();
  32. virtual void Precache();
  33. virtual int GetWeaponID( void ) const { return ShouldPenetrate() ? TF_WEAPON_RAYGUN : TF_WEAPON_DRG_POMSON; }
  34. #ifdef GAME_DLL
  35. virtual void ProjectileTouch( CBaseEntity *pOther ) OVERRIDE;
  36. virtual void ResolveFlyCollisionCustom( trace_t &trace, Vector &vecVelocity ) OVERRIDE;
  37. #else
  38. virtual void OnDataChanged( DataUpdateType_t updateType ) OVERRIDE;
  39. #endif
  40. virtual bool CanHeadshot() { return false; }
  41. virtual void ImpactTeamPlayer( CTFPlayer *pOther ) {}
  42. virtual float GetDamage();
  43. virtual int GetDamageCustom() { return TF_DMG_CUSTOM_PLASMA; }
  44. virtual bool IsDeflectable() { return false; }
  45. void SetColor( int idx, Vector vColor ) { if ( idx==1 ) m_vColor1=vColor; else m_vColor2=vColor; }
  46. float GetInitialVelocity( void );
  47. private:
  48. bool ShouldPenetrate() const;
  49. const char* GetTrailParticleName() const;
  50. Vector m_vColor1;
  51. Vector m_vColor2;
  52. Vector m_vecPrevPos;
  53. #ifdef GAME_DLL
  54. CUtlVector<EHANDLE> m_vecHitEnemies;
  55. void PlayImpactEffects( const Vector& vecPos, bool bHitFlesh );
  56. #endif
  57. protected:
  58. float m_flInitTime;
  59. };
  60. #endif //TF_PROJECTILE_ENERGY_RING_H