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.

44 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Used to influence the initial force for a dying NPC's ragdoll.
  4. // Passive entity. Just represents position in the world, radius, force
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #pragma once
  9. #ifndef CRAGDOLLMAGNET_H
  10. #define CRAGDOLLMAGNET_H
  11. #define SF_RAGDOLLMAGNET_BAR 0x00000002 // this is a bar magnet.
  12. class CRagdollMagnet : public CPointEntity
  13. {
  14. public:
  15. DECLARE_CLASS( CRagdollMagnet, CPointEntity );
  16. DECLARE_DATADESC();
  17. Vector GetForceVector( CBaseEntity *pNPC );
  18. float GetRadius( void ) { return m_radius; }
  19. Vector GetAxisVector( void ) { return m_axis - GetAbsOrigin(); }
  20. float DistToPoint( const Vector &vecPoint );
  21. bool IsEnabled( void ) { return !m_bDisabled; }
  22. int IsBarMagnet( void ) { return (m_spawnflags & SF_RAGDOLLMAGNET_BAR); }
  23. static CRagdollMagnet *FindBestMagnet( CBaseEntity *pNPC );
  24. void Enable( bool bEnable ) { m_bDisabled = !bEnable; }
  25. // Inputs
  26. void InputEnable( inputdata_t &inputdata );
  27. void InputDisable( inputdata_t &inputdata );
  28. private:
  29. bool m_bDisabled;
  30. float m_radius;
  31. float m_force;
  32. Vector m_axis;
  33. };
  34. #endif //CRAGDOLLMAGNET_H