summaryrefslogtreecommitdiff
path: root/game/server/hl1/hl1_item_suit.cpp
blob: 83644fe29e8db8488a1cdc97fdda916111bff4f6 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================//
/*
===== item_suit.cpp ========================================================

  handling for the player's suit.
*/

#include "cbase.h"
#include "player.h"
#include "gamerules.h"
#include "items.h"
#include "hl1_items.h"


#define SF_SUIT_SHORTLOGON		0x0001

#define SUIT_MODEL "models/w_suit.mdl"

extern int gEvilImpulse101;

class CItemSuit : public CHL1Item
{
public:
	DECLARE_CLASS( CItemSuit, CHL1Item );

	void Spawn( void )
	{ 
		Precache( );
		SetModel( SUIT_MODEL );
		BaseClass::Spawn( );

		CollisionProp()->UseTriggerBounds( true, 12.0f );
	}
	void Precache( void )
	{
		PrecacheModel( SUIT_MODEL );
	}
	bool MyTouch( CBasePlayer *pPlayer )
	{
		if ( pPlayer->IsSuitEquipped() )
			return false;

		if( !gEvilImpulse101 )
		{
			if ( HasSpawnFlags( SF_SUIT_SHORTLOGON ) )
				UTIL_EmitSoundSuit(pPlayer->edict(), "!HEV_A0");		// short version of suit logon,
			else
				UTIL_EmitSoundSuit(pPlayer->edict(), "!HEV_AAx");	// long version of suit logon
		}

		pPlayer->EquipSuit();
		return true;
	}
};

LINK_ENTITY_TO_CLASS(item_suit, CItemSuit);
PRECACHE_REGISTER(item_suit);