summaryrefslogtreecommitdiff
path: root/game/server/tf/tf_props.h
blob: e8298e839d0de4197ba85b074e55cd9fe26509e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: static_prop - don't move, don't animate, don't do anything.
//			physics_prop - move, take damage, but don't animate
//
//===========================================================================//

#ifndef TF_PROPS_H
#define TF_PROPS_H

#include "props.h"
#include "triggers.h"
#include "tf_player.h"

class CPropSoccerBall : public CPhysicsProp
{
	DECLARE_CLASS( CPropSoccerBall, CPhysicsProp );
public:
	CPropSoccerBall()
		: m_flNextAllowedImpactTime( 0.f ), m_hLastToucher( NULL )
	{}

	DECLARE_DATADESC()

	virtual void Precache();
	virtual void Spawn();

	// Here's the deal.  The ball is a trigger, but triggers are not allowed to touch other triggers.  To get around this,
	// we're going to specify the names of the triggers we actually want to touch and then we're going to manually try to 
	// touch them.  Our collision system is a vortex of insanity.
	void TriggerTouchThink();
	virtual void Activate() OVERRIDE;
	virtual bool TestCollision( const Ray_t &ray, unsigned int mask, trace_t& trace );
	virtual void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent ){}
	void BallTouch( CBaseEntity *pOther );
	CTFPlayer *GetLastToucher( void ){ return m_hLastToucher.Get(); }

	virtual bool ShouldBlockNav() const OVERRIDE { return false; }

private:
	string_t m_iszTriggers;
	float m_flNextAllowedImpactTime;
	CUtlVector< CBaseTrigger* > m_vecTriggers;
	CHandle< CTFPlayer > m_hLastToucher;
};

#endif // TF_PROPS_H