mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 14:17:59 +03:00
Merge pull request #229 from arbabf/develop
Extend point_bugbait functionality
This commit is contained in:
commit
68ea86ec4f
@ -35,6 +35,9 @@ CBugBaitSensor* GetBugBaitSensorList()
|
|||||||
CBugBaitSensor::CBugBaitSensor( void )
|
CBugBaitSensor::CBugBaitSensor( void )
|
||||||
{
|
{
|
||||||
g_BugBaitSensorList.Insert( this );
|
g_BugBaitSensorList.Insert( this );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_bUseRadius = true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CBugBaitSensor::~CBugBaitSensor( void )
|
CBugBaitSensor::~CBugBaitSensor( void )
|
||||||
@ -50,10 +53,24 @@ BEGIN_DATADESC( CBugBaitSensor )
|
|||||||
DEFINE_KEYFIELD( m_bEnabled, FIELD_BOOLEAN, "Enabled" ),
|
DEFINE_KEYFIELD( m_bEnabled, FIELD_BOOLEAN, "Enabled" ),
|
||||||
DEFINE_KEYFIELD( m_flRadius, FIELD_FLOAT, "radius" ),
|
DEFINE_KEYFIELD( m_flRadius, FIELD_FLOAT, "radius" ),
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
DEFINE_KEYFIELD( m_bUseRadius, FIELD_BOOLEAN, "useradius" ),
|
||||||
|
DEFINE_KEYFIELD( m_vecMins, FIELD_VECTOR, "bmins" ),
|
||||||
|
DEFINE_KEYFIELD( m_vecMaxs, FIELD_VECTOR, "bmaxs" ),
|
||||||
|
#endif
|
||||||
|
|
||||||
DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
|
DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
|
||||||
DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
|
DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
|
||||||
DEFINE_INPUTFUNC( FIELD_VOID, "Toggle", InputToggle ),
|
DEFINE_INPUTFUNC( FIELD_VOID, "Toggle", InputToggle ),
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VOID, "EnableRadius", InputEnableRadius ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VOID, "DisableRadius", InputDisableRadius ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetRadius", InputSetRadius ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetMins", InputSetMins ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetMaxs", InputSetMaxs ),
|
||||||
|
#endif
|
||||||
|
|
||||||
// Function Pointers
|
// Function Pointers
|
||||||
DEFINE_OUTPUT( m_OnBaited, "OnBaited" ),
|
DEFINE_OUTPUT( m_OnBaited, "OnBaited" ),
|
||||||
|
|
||||||
@ -267,18 +284,42 @@ bool CGrenadeBugBait::ActivateBugbaitTargets( CBaseEntity *pOwner, Vector vecOri
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Make sure we're within range of the sensor
|
//Make sure we're within range of the sensor
|
||||||
if ( pSensor->GetRadius() > ( pSensor->GetAbsOrigin() - vecOrigin ).Length() )
|
#ifdef MAPBASE
|
||||||
{
|
if ( pSensor->UsesRadius() ){
|
||||||
//Tell the sensor it's been hit
|
#endif
|
||||||
if ( pSensor->Baited( pOwner ) )
|
if ( pSensor->GetRadius() > (pSensor->GetAbsOrigin() - vecOrigin).Length() )
|
||||||
{
|
{
|
||||||
//If we're suppressing the call to antlions, then don't make a bugbait sound
|
//Tell the sensor it's been hit
|
||||||
if ( pSensor->SuppressCall() )
|
if ( pSensor->Baited( pOwner ) )
|
||||||
{
|
{
|
||||||
suppressCall = true;
|
//If we're suppressing the call to antlions, then don't make a bugbait sound
|
||||||
|
if ( pSensor->SuppressCall() )
|
||||||
|
{
|
||||||
|
suppressCall = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Vector vMins = pSensor->GetAbsMins();
|
||||||
|
Vector vMaxs = pSensor->GetAbsMaxs();
|
||||||
|
bool inBox = ((vecOrigin.x >= vMins.x && vecOrigin.x <= vMaxs.x) &&
|
||||||
|
(vecOrigin.y >= vMins.y && vecOrigin.y <= vMaxs.y) &&
|
||||||
|
(vecOrigin.z >= vMins.z && vecOrigin.z <= vMaxs.z));
|
||||||
|
if ( inBox ){
|
||||||
|
//Tell the sensor it's been hit
|
||||||
|
if ( pSensor->Baited( pOwner ) )
|
||||||
|
{
|
||||||
|
//If we're suppressing the call to antlions, then don't make a bugbait sound
|
||||||
|
if ( pSensor->SuppressCall() )
|
||||||
|
{
|
||||||
|
suppressCall = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return suppressCall;
|
return suppressCall;
|
||||||
|
@ -63,6 +63,28 @@ public:
|
|||||||
m_bEnabled = !m_bEnabled;
|
m_bEnabled = !m_bEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void InputEnableRadius( inputdata_t &data ){
|
||||||
|
m_bUseRadius = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputDisableRadius( inputdata_t &data ){
|
||||||
|
m_bUseRadius = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputSetRadius( inputdata_t &data ){
|
||||||
|
m_flRadius = data.value.Int();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputSetMins( inputdata_t &data ){
|
||||||
|
data.value.Vector3D( m_vecMins );
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputSetMaxs( inputdata_t &data ){
|
||||||
|
data.value.Vector3D( m_vecMaxs );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool SuppressCall( void )
|
bool SuppressCall( void )
|
||||||
{
|
{
|
||||||
return ( HasSpawnFlags( SF_BUGBAIT_SUPPRESS_CALL ) );
|
return ( HasSpawnFlags( SF_BUGBAIT_SUPPRESS_CALL ) );
|
||||||
@ -91,10 +113,28 @@ public:
|
|||||||
return !m_bEnabled;
|
return !m_bEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool UsesRadius( void ) const {
|
||||||
|
return m_bUseRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector GetAbsMins( void ) const {
|
||||||
|
return GetAbsOrigin() + m_vecMins;
|
||||||
|
}
|
||||||
|
Vector GetAbsMaxs( void ) const {
|
||||||
|
return GetAbsOrigin() + m_vecMaxs;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
float m_flRadius;
|
float m_flRadius;
|
||||||
bool m_bEnabled;
|
bool m_bEnabled;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bUseRadius;
|
||||||
|
Vector m_vecMins;
|
||||||
|
Vector m_vecMaxs;
|
||||||
|
#endif
|
||||||
COutputEvent m_OnBaited;
|
COutputEvent m_OnBaited;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user