blob: 7a5df993668ec0326a01e6b6baf2dbc2b80ac3de (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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
|