summaryrefslogtreecommitdiff
path: root/game/server/tf2/tf_obj_sandbag_bunker.cpp
blob: d3d012fb556803dc9b81808ac389d92d6c598569 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: A stationary sandbag bunker that players can take cover in.
//
// $NoKeywords: $
//=============================================================================//

#include "cbase.h"
#include "tf_obj.h"
#include "tf_team.h"
#include "engine/IEngineSound.h"
#include "tf_obj_sandbag_bunker.h"

#define SANDBAGBUNKER_MINS			Vector(-60, -60, 0)
#define SANDBAGBUNKER_MAXS			Vector( 60,  60, 50)
#define SANDBAGBUNKER_MODEL			"models/objects/obj_sandbag_bunker.mdl"


IMPLEMENT_SERVERCLASS_ST(CObjectSandbagBunker, DT_ObjectSandbagBunker)
END_SEND_TABLE();

LINK_ENTITY_TO_CLASS(obj_sandbag_bunker, CObjectSandbagBunker);
PRECACHE_REGISTER(obj_sandbag_bunker);

// CVars
ConVar	obj_sandbag_bunker_health( "obj_sandbag_bunker_health","100", FCVAR_NONE, "Sandbag bunker health" );

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CObjectSandbagBunker::CObjectSandbagBunker( void )
{
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CObjectSandbagBunker::Spawn( void )
{
	Precache();
	SetModel( SANDBAGBUNKER_MODEL );
	SetSolid( SOLID_BBOX );

	UTIL_SetSize(this, SANDBAGBUNKER_MINS, SANDBAGBUNKER_MAXS);
	m_takedamage = DAMAGE_YES;
	m_iHealth = obj_sandbag_bunker_health.GetInt();

	m_fObjectFlags |= OF_DOESNT_NEED_POWER;
	SetType( OBJ_SANDBAG_BUNKER );

	SetSolid( SOLID_VPHYSICS );
	VPhysicsInitStatic();

	BaseClass::Spawn();

	SetCollisionGroup( COLLISION_GROUP_VEHICLE );
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CObjectSandbagBunker::Precache( void )
{
	PrecacheModel( SANDBAGBUNKER_MODEL );
}

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