summaryrefslogtreecommitdiff
path: root/game/server/tf2/tf_vehicle_motorcycle.cpp
blob: c5cbf600f763c55d95dc3962e7d3732293a60c71 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//

#include "cbase.h"
#include "engine/IEngineSound.h"
#include "VGuiScreen.h"
#include "tf_basefourwheelvehicle.h"
#include "vphysics/vehicles.h"

#define MOTORCYCLE_MINS			Vector(-30, -50, -10)
#define MOTORCYCLE_MAXS			Vector( 30,  50, 55)
#define MOTORCYCLE_MODEL			"models/objects/vehicle_motorcycle.mdl"

// ------------------------------------------------------------------------ //
// Purpose:
// ------------------------------------------------------------------------ //
class CVehicleMotorcycle : public CBaseTFFourWheelVehicle
{
	DECLARE_CLASS( CVehicleMotorcycle, CBaseTFFourWheelVehicle );

public:
	DECLARE_SERVERCLASS();

	static CVehicleMotorcycle* Create(const Vector &vOrigin, const QAngle &vAngles);

	CVehicleMotorcycle();

	virtual void	Spawn();
	virtual void	Precache();
	virtual void	GetControlPanelInfo( int nPanelIndex, const char *&pPanelName );
	virtual bool	CanTakeEMPDamage( void ) { return true; }

	// Vehicle overrides
	virtual bool	IsPassengerVisible( int nRole ) { return true; }
};

IMPLEMENT_SERVERCLASS_ST(CVehicleMotorcycle, DT_VehicleMotorcycle)
END_SEND_TABLE();

LINK_ENTITY_TO_CLASS(vehicle_motorcycle, CVehicleMotorcycle);
PRECACHE_REGISTER(vehicle_motorcycle);

// CVars
ConVar	vehicle_motorcycle_health( "vehicle_motorcycle_health","200", FCVAR_NONE, "Motorcycle health" );


//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CVehicleMotorcycle::CVehicleMotorcycle()
{

}


//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CVehicleMotorcycle::Precache()
{
	PrecacheModel( MOTORCYCLE_MODEL );

	PrecacheVGuiScreen( "screen_vulnerable_point");
	
	BaseClass::Precache();
}


//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CVehicleMotorcycle::Spawn()
{
	SetModel( MOTORCYCLE_MODEL );
	
	// This size is used for placement only...
	UTIL_SetSize(this, MOTORCYCLE_MINS, MOTORCYCLE_MAXS);
	m_takedamage = DAMAGE_YES;
	m_iHealth = vehicle_motorcycle_health.GetInt();

	SetType( OBJ_VEHICLE_MOTORCYCLE );
	SetMaxPassengerCount( 4 );

	BaseClass::Spawn();
}


//-----------------------------------------------------------------------------
// Purpose: Gets info about the control panels
//-----------------------------------------------------------------------------
void CVehicleMotorcycle::GetControlPanelInfo( int nPanelIndex, const char *&pPanelName )
{
	pPanelName = "screen_vulnerable_point";
}