mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 23:05:30 +03:00
Added plant orientation to combine_mine
This commit is contained in:
parent
188293b93c
commit
c8f48407c1
@ -58,6 +58,10 @@ char *pszMineStateNames[] =
|
|||||||
// Approximate radius of the bomb's model
|
// Approximate radius of the bomb's model
|
||||||
#define BOUNCEBOMB_RADIUS 24
|
#define BOUNCEBOMB_RADIUS 24
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
ConVar combine_mine_trace_dist( "combine_mine_trace_dist", "1024" );
|
||||||
|
#endif
|
||||||
|
|
||||||
BEGIN_DATADESC( CBounceBomb )
|
BEGIN_DATADESC( CBounceBomb )
|
||||||
DEFINE_THINKFUNC( ExplodeThink ),
|
DEFINE_THINKFUNC( ExplodeThink ),
|
||||||
DEFINE_ENTITYFUNC( ExplodeTouch ),
|
DEFINE_ENTITYFUNC( ExplodeTouch ),
|
||||||
@ -129,6 +133,8 @@ BEGIN_DATADESC( CBounceBomb )
|
|||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
DEFINE_INPUTFUNC( FIELD_VOID, "Bounce", InputBounce ),
|
DEFINE_INPUTFUNC( FIELD_VOID, "Bounce", InputBounce ),
|
||||||
DEFINE_INPUTFUNC( FIELD_EHANDLE, "BounceAtTarget", InputBounceAtTarget ),
|
DEFINE_INPUTFUNC( FIELD_EHANDLE, "BounceAtTarget", InputBounceAtTarget ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetPlantOrientation", InputSetPlantOrientation ),
|
||||||
|
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetPlantOrientationRaw", InputSetPlantOrientationRaw ),
|
||||||
|
|
||||||
DEFINE_OUTPUT( m_OnTriggered, "OnTriggered" ),
|
DEFINE_OUTPUT( m_OnTriggered, "OnTriggered" ),
|
||||||
DEFINE_OUTPUT( m_OnExplode, "OnExplode" ),
|
DEFINE_OUTPUT( m_OnExplode, "OnExplode" ),
|
||||||
@ -266,6 +272,14 @@ void CBounceBomb::Spawn()
|
|||||||
// pretend like the player set me down.
|
// pretend like the player set me down.
|
||||||
m_bPlacedByPlayer = true;
|
m_bPlacedByPlayer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_vecPlantOrientation != vec3_invalid)
|
||||||
|
{
|
||||||
|
// Turn angles into direction
|
||||||
|
AngleVectors( QAngle( m_vecPlantOrientation.x, m_vecPlantOrientation.y, m_vecPlantOrientation.z ), &m_vecPlantOrientation );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@ -694,7 +708,20 @@ void CBounceBomb::SettleThink()
|
|||||||
{
|
{
|
||||||
// If i'm not resting on the world, jump randomly.
|
// If i'm not resting on the world, jump randomly.
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector( 0, 0, 1024 ), MASK_SHOT|CONTENTS_GRATE, this, COLLISION_GROUP_NONE, &tr );
|
#ifdef MAPBASE
|
||||||
|
Vector vecTraceDir;
|
||||||
|
if (m_vecPlantOrientation != vec3_invalid)
|
||||||
|
{
|
||||||
|
vecTraceDir = m_vecPlantOrientation * combine_mine_trace_dist.GetFloat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vecTraceDir = Vector( 0, 0, combine_mine_trace_dist.GetFloat() );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Vector vecTraceDir = Vector( 0, 0, 1024 );
|
||||||
|
#endif
|
||||||
|
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - vecTraceDir, MASK_SHOT|CONTENTS_GRATE, this, COLLISION_GROUP_NONE, &tr );
|
||||||
|
|
||||||
bool bHop = false;
|
bool bHop = false;
|
||||||
if( tr.m_pEnt )
|
if( tr.m_pEnt )
|
||||||
@ -728,6 +755,20 @@ void CBounceBomb::SettleThink()
|
|||||||
// Check for upside-down
|
// Check for upside-down
|
||||||
Vector vecUp;
|
Vector vecUp;
|
||||||
GetVectors( NULL, NULL, &vecUp );
|
GetVectors( NULL, NULL, &vecUp );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_vecPlantOrientation != vec3_invalid)
|
||||||
|
{
|
||||||
|
float flDiff = abs(m_vecPlantOrientation.z - vecUp.z);
|
||||||
|
if ( flDiff >= 0.2f )
|
||||||
|
{
|
||||||
|
// Landed upside down. Right self
|
||||||
|
Vector vecForce( 0, 0, 2500 );
|
||||||
|
Flip( vecForce, AngularImpulse( 60, 0, 0 ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
if( vecUp.z <= 0.8 )
|
if( vecUp.z <= 0.8 )
|
||||||
{
|
{
|
||||||
// Landed upside down. Right self
|
// Landed upside down. Right self
|
||||||
@ -1442,6 +1483,22 @@ void CBounceBomb::InputBounceAtTarget( inputdata_t &inputdata )
|
|||||||
m_hNearestNPC = inputdata.value.Entity();
|
m_hNearestNPC = inputdata.value.Entity();
|
||||||
SetMineState(MINE_STATE_TRIGGERED);
|
SetMineState(MINE_STATE_TRIGGERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
//---------------------------------------------------------
|
||||||
|
void CBounceBomb::InputSetPlantOrientation( inputdata_t &inputdata )
|
||||||
|
{
|
||||||
|
Vector vecInput;
|
||||||
|
inputdata.value.Vector3D( vecInput );
|
||||||
|
AngleVectors( QAngle(vecInput.x, vecInput.y, vecInput.z), &m_vecPlantOrientation );
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------
|
||||||
|
//---------------------------------------------------------
|
||||||
|
void CBounceBomb::InputSetPlantOrientationRaw( inputdata_t &inputdata )
|
||||||
|
{
|
||||||
|
inputdata.value.Vector3D( m_vecPlantOrientation );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
@ -34,7 +34,7 @@ class CBounceBomb : public CBaseAnimating, public CDefaultPlayerPickupVPhysics
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
CBounceBomb() { m_pWarnSound = NULL; m_bPlacedByPlayer = false; m_flExplosionDelay = 0.5f; m_iLOSMask = MASK_SOLID_BRUSHONLY; }
|
CBounceBomb() { m_pWarnSound = NULL; m_bPlacedByPlayer = false; m_flExplosionDelay = 0.5f; m_iLOSMask = MASK_SOLID_BRUSHONLY; m_vecPlantOrientation = vec3_invalid; }
|
||||||
#else
|
#else
|
||||||
CBounceBomb() { m_pWarnSound = NULL; m_bPlacedByPlayer = false; }
|
CBounceBomb() { m_pWarnSound = NULL; m_bPlacedByPlayer = false; }
|
||||||
#endif
|
#endif
|
||||||
@ -130,6 +130,10 @@ private:
|
|||||||
int m_iLOSMask;
|
int m_iLOSMask;
|
||||||
|
|
||||||
bool m_bUnavoidable;
|
bool m_bUnavoidable;
|
||||||
|
|
||||||
|
// What direction the mine should be facing when planting itself (i.e. facing up, facing left, etc.)
|
||||||
|
// vec3_invalid = use default (0 0 1 or -90 0 0)
|
||||||
|
Vector m_vecPlantOrientation;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool m_bPlacedByPlayer;
|
bool m_bPlacedByPlayer;
|
||||||
@ -164,6 +168,8 @@ private:
|
|||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
void InputBounce( inputdata_t &inputdata );
|
void InputBounce( inputdata_t &inputdata );
|
||||||
void InputBounceAtTarget( inputdata_t &inputdata );
|
void InputBounceAtTarget( inputdata_t &inputdata );
|
||||||
|
void InputSetPlantOrientation( inputdata_t &inputdata );
|
||||||
|
void InputSetPlantOrientationRaw( inputdata_t &inputdata );
|
||||||
COutputEvent m_OnTriggered;
|
COutputEvent m_OnTriggered;
|
||||||
COutputEvent m_OnExplode;
|
COutputEvent m_OnExplode;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user