aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/hl2/grenade_bugbait.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/server/hl2/grenade_bugbait.h
downloadsource-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/grenade_bugbait.h')
-rw-r--r--sp/src/game/server/hl2/grenade_bugbait.h135
1 files changed, 135 insertions, 0 deletions
diff --git a/sp/src/game/server/hl2/grenade_bugbait.h b/sp/src/game/server/hl2/grenade_bugbait.h
new file mode 100644
index 00000000..2d5b0cf0
--- /dev/null
+++ b/sp/src/game/server/hl2/grenade_bugbait.h
@@ -0,0 +1,135 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef GRENADE_BUGBAIT_H
+#define GRENADE_BUGBAIT_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "smoke_trail.h"
+#include "basegrenade_shared.h"
+
+//Radius of the bugbait's effect on other creatures
+extern ConVar bugbait_radius;
+extern ConVar bugbait_hear_radius;
+extern ConVar bugbait_distract_time;
+extern ConVar bugbait_grenade_radius;
+
+#define SF_BUGBAIT_SUPPRESS_CALL 0x00000001
+#define SF_BUGBAIT_NOT_THROWN 0x00000002 // Don't detect player throwing the bugbait near this point
+#define SF_BUGBAIT_NOT_SQUEEZE 0x00000004 // Don't detect player squeezing the bugbait
+
+//=============================================================================
+// Bugbait sensor
+//=============================================================================
+
+class CBugBaitSensor : public CPointEntity
+{
+public:
+
+ DECLARE_CLASS( CBugBaitSensor, CPointEntity );
+
+ DECLARE_DATADESC();
+
+ CBugBaitSensor( void );
+ ~CBugBaitSensor( void );
+
+ bool Baited( CBaseEntity *pOther )
+ {
+ if ( !m_bEnabled )
+ return false;
+
+ m_OnBaited.FireOutput( pOther, this );
+ return true;
+ }
+
+ void InputEnable( inputdata_t &data )
+ {
+ m_bEnabled = true;
+ }
+
+ void InputDisable( inputdata_t &data )
+ {
+ m_bEnabled = false;
+ }
+
+ void InputToggle( inputdata_t &data )
+ {
+ m_bEnabled = !m_bEnabled;
+ }
+
+ bool SuppressCall( void )
+ {
+ return ( HasSpawnFlags( SF_BUGBAIT_SUPPRESS_CALL ) );
+ }
+
+ bool DetectsSqueeze( void )
+ {
+ return ( !HasSpawnFlags( SF_BUGBAIT_NOT_SQUEEZE ) );
+ }
+
+ bool DetectsThrown( void )
+ {
+ return ( !HasSpawnFlags( SF_BUGBAIT_NOT_THROWN ) );
+ }
+
+ float GetRadius( void ) const
+ {
+ if ( m_flRadius == 0 )
+ return bugbait_radius.GetFloat();
+
+ return m_flRadius;
+ }
+
+ bool IsDisabled( void ) const
+ {
+ return !m_bEnabled;
+ }
+
+protected:
+
+ float m_flRadius;
+ bool m_bEnabled;
+ COutputEvent m_OnBaited;
+
+public:
+ CBugBaitSensor *m_pNext;
+};
+
+//
+// Bug Bait Grenade
+//
+
+class CGrenadeBugBait : public CBaseGrenade
+{
+ DECLARE_CLASS( CGrenadeBugBait, CBaseGrenade );
+public:
+ void Spawn( void );
+ void Precache( void );
+
+ void ThinkBecomeSolid( void );
+ void SetGracePeriod( float duration );
+
+ void BugBaitTouch( CBaseEntity *pOther );
+
+ // Activate nearby bugbait targets
+ static bool ActivateBugbaitTargets( CBaseEntity *pOwner, Vector vecOrigin, bool bSqueezed );
+
+ DECLARE_DATADESC();
+
+protected:
+ void CreateTarget( const Vector &position, CBaseEntity *pOther );
+
+ float m_flGracePeriodEndsAt;
+
+ SporeTrail *m_pSporeTrail;
+};
+
+extern CGrenadeBugBait *BugBaitGrenade_Create( const Vector &position, const QAngle &angles, const Vector &velocity, const QAngle &angVelocity, CBaseEntity *owner );
+
+#endif // GRENADE_BUGBAIT_H