Skip to content

Commit bd24577

Browse files
committed
Keyvalue to allow npc_combinedropship to be affected by heli avoid ents
1 parent 6cc2937 commit bd24577

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

sp/src/game/server/hl2/npc_combinedropship.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ class CNPC_CombineDropship : public CBaseHelicopter
340340
bool m_bWaitForDropoffInput;
341341
#ifdef MAPBASE
342342
bool m_bDontEmitDanger;
343+
bool m_bUseAvoidEnts;
343344
#endif
344345

345346
DECLARE_DATADESC();
@@ -827,6 +828,7 @@ BEGIN_DATADESC( CNPC_CombineDropship )
827828
DEFINE_FIELD( m_bWaitForDropoffInput, FIELD_BOOLEAN ),
828829
#ifdef MAPBASE
829830
DEFINE_KEYFIELD( m_bDontEmitDanger, FIELD_BOOLEAN, "DontEmitDanger" ),
831+
DEFINE_KEYFIELD( m_bUseAvoidEnts, FIELD_BOOLEAN, "UseAvoidEnts" ),
830832
#endif
831833
DEFINE_FIELD( m_hLandTarget, FIELD_EHANDLE ),
832834
DEFINE_FIELD( m_bHasDroppedOff, FIELD_BOOLEAN ),
@@ -1380,6 +1382,18 @@ void CNPC_CombineDropship::Flight( void )
13801382
}
13811383
}
13821384

1385+
#ifdef MAPBASE
1386+
// Apply avoidance forces
1387+
if ( m_bUseAvoidEnts )
1388+
{
1389+
Vector vecAvoidForce;
1390+
CAvoidSphere::ComputeAvoidanceForces( this, 350.0f, 2.0f, &vecAvoidForce );
1391+
accel += vecAvoidForce;
1392+
CAvoidBox::ComputeAvoidanceForces( this, 350.0f, 2.0f, &vecAvoidForce );
1393+
accel += vecAvoidForce;
1394+
}
1395+
#endif
1396+
13831397
// don't fall faster than 0.2G or climb faster than 2G
13841398
accel.z = clamp( accel.z, 384 * 0.2, 384 * 2.0 );
13851399

0 commit comments

Comments
 (0)