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.

46 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: static_prop - don't move, don't animate, don't do anything.
  4. // physics_prop - move, take damage, but don't animate
  5. //
  6. //===========================================================================//
  7. #ifndef TF_PROPS_H
  8. #define TF_PROPS_H
  9. #include "props.h"
  10. #include "triggers.h"
  11. #include "tf_player.h"
  12. class CPropSoccerBall : public CPhysicsProp
  13. {
  14. DECLARE_CLASS( CPropSoccerBall, CPhysicsProp );
  15. public:
  16. CPropSoccerBall()
  17. : m_flNextAllowedImpactTime( 0.f ), m_hLastToucher( NULL )
  18. {}
  19. DECLARE_DATADESC()
  20. virtual void Precache();
  21. virtual void Spawn();
  22. // Here's the deal. The ball is a trigger, but triggers are not allowed to touch other triggers. To get around this,
  23. // we're going to specify the names of the triggers we actually want to touch and then we're going to manually try to
  24. // touch them. Our collision system is a vortex of insanity.
  25. void TriggerTouchThink();
  26. virtual void Activate() OVERRIDE;
  27. virtual bool TestCollision( const Ray_t &ray, unsigned int mask, trace_t& trace );
  28. virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent ){}
  29. void BallTouch( CBaseEntity *pOther );
  30. CTFPlayer *GetLastToucher( void ){ return m_hLastToucher.Get(); }
  31. virtual bool ShouldBlockNav() const OVERRIDE { return false; }
  32. private:
  33. string_t m_iszTriggers;
  34. float m_flNextAllowedImpactTime;
  35. CUtlVector< CBaseTrigger* > m_vecTriggers;
  36. CHandle< CTFPlayer > m_hLastToucher;
  37. };
  38. #endif // TF_PROPS_H