summaryrefslogtreecommitdiff
path: root/game/server/hl1/hl1_item_longjump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/server/hl1/hl1_item_longjump.cpp')
-rw-r--r--game/server/hl1/hl1_item_longjump.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/game/server/hl1/hl1_item_longjump.cpp b/game/server/hl1/hl1_item_longjump.cpp
new file mode 100644
index 0000000..3ecfd9a
--- /dev/null
+++ b/game/server/hl1/hl1_item_longjump.cpp
@@ -0,0 +1,61 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+
+#include "cbase.h"
+#include "player.h"
+#include "gamerules.h"
+#include "items.h"
+#include "hl1_items.h"
+#include "hl1_player.h"
+
+
+class CItemLongJump : public CHL1Item
+{
+public:
+ DECLARE_CLASS( CItemLongJump, CHL1Item );
+
+ void Spawn( void )
+ {
+ Precache( );
+ SetModel( "models/w_longjump.mdl" );
+ BaseClass::Spawn( );
+
+ CollisionProp()->UseTriggerBounds( true, 16.0f );
+ }
+ void Precache( void )
+ {
+ PrecacheModel ("models/w_longjump.mdl");
+ }
+ bool MyTouch( CBasePlayer *pPlayer )
+ {
+ CHL1_Player *pHL1Player = (CHL1_Player*)pPlayer;
+
+ if ( pHL1Player->m_bHasLongJump == true )
+ {
+ return false;
+ }
+
+ if ( pHL1Player->IsSuitEquipped() )
+ {
+ pHL1Player->m_bHasLongJump = true;// player now has longjump module
+
+ CSingleUserRecipientFilter user( pHL1Player );
+ user.MakeReliable();
+
+ UserMessageBegin( user, "ItemPickup" );
+ WRITE_STRING( STRING(m_iClassname) );
+ MessageEnd();
+
+ UTIL_EmitSoundSuit( pHL1Player->edict(), "!HEV_A1" ); // Play the longjump sound UNDONE: Kelly? correct sound?
+ return true;
+ }
+ return false;
+ }
+};
+
+LINK_ENTITY_TO_CLASS( item_longjump, CItemLongJump );
+PRECACHE_REGISTER(item_longjump);