diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/server/hl2/item_suit.cpp | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/server/hl2/item_suit.cpp')
| -rw-r--r-- | sp/src/game/server/hl2/item_suit.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/sp/src/game/server/hl2/item_suit.cpp b/sp/src/game/server/hl2/item_suit.cpp new file mode 100644 index 00000000..32f7a322 --- /dev/null +++ b/sp/src/game/server/hl2/item_suit.cpp @@ -0,0 +1,58 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//
+//=============================================================================//
+/*
+
+===== item_suit.cpp ========================================================
+
+ handling for the player's suit.
+*/
+
+#include "cbase.h"
+#include "player.h"
+#include "gamerules.h"
+#include "items.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+#define SF_SUIT_SHORTLOGON 0x0001
+
+class CItemSuit : public CItem
+{
+public:
+ DECLARE_CLASS( CItemSuit, CItem );
+
+ void Spawn( void )
+ {
+ Precache( );
+ SetModel( "models/items/hevsuit.mdl" );
+ BaseClass::Spawn( );
+
+ CollisionProp()->UseTriggerBounds( false, 0 );
+ }
+ void Precache( void )
+ {
+ PrecacheModel ("models/items/hevsuit.mdl");
+ }
+ bool MyTouch( CBasePlayer *pPlayer )
+ {
+ if ( pPlayer->IsSuitEquipped() )
+ return FALSE;
+
+ if ( m_spawnflags & 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);
|