Added keyvalue to combine_mine for disabling companion avoidance

This commit is contained in:
Blixibon 2021-03-07 11:55:08 -06:00
parent 15ae789b89
commit 8f7d3ac03b
3 changed files with 19 additions and 1 deletions

View File

@ -91,6 +91,7 @@ BEGIN_DATADESC( CBounceBomb )
DEFINE_KEYFIELD( m_iInitialState, FIELD_INTEGER, "InitialState" ),
DEFINE_KEYFIELD( m_bCheapWarnSound, FIELD_BOOLEAN, "CheapWarnSound" ),
DEFINE_KEYFIELD( m_iLOSMask, FIELD_INTEGER, "LOSMask" ),
DEFINE_INPUT( m_bUnavoidable, FIELD_BOOLEAN, "SetUnavoidable" ),
#endif
DEFINE_KEYFIELD( m_iModification, FIELD_INTEGER, "Modification" ),
@ -1485,6 +1486,18 @@ CBasePlayer *CBounceBomb::HasPhysicsAttacker( float dt )
return NULL;
}
//---------------------------------------------------------
//---------------------------------------------------------
bool CBounceBomb::ShouldBeAvoidedByCompanions()
{
#ifdef MAPBASE
if (m_bUnavoidable)
return false;
#endif
return !IsPlayerPlaced() && IsAwake();
}
//---------------------------------------------------------
//---------------------------------------------------------
void CBounceBomb::OnPhysGunPickup( CBasePlayer *pPhysGunUser, PhysGunPickup_t reason )

View File

@ -72,6 +72,9 @@ public:
bool IsPlayerPlaced() { return m_bPlacedByPlayer; }
// Determines whether companions should treat the mine as a navigation obstacle and avoid it
bool ShouldBeAvoidedByCompanions();
bool CreateVPhysics()
{
VPhysicsInitNormal( SOLID_VPHYSICS, 0, false );
@ -125,6 +128,8 @@ private:
// Allows control over the mask used in LOS
int m_iLOSMask;
bool m_bUnavoidable;
#endif
bool m_bPlacedByPlayer;

View File

@ -3423,7 +3423,7 @@ bool CNPC_PlayerCompanion::OverrideMove( float flInterval )
else if ( pEntity->m_iClassname == iszBounceBomb )
{
CBounceBomb *pBomb = static_cast<CBounceBomb *>(pEntity);
if ( pBomb && !pBomb->IsPlayerPlaced() && pBomb->IsAwake() )
if ( pBomb && pBomb->ShouldBeAvoidedByCompanions() )
{
UTIL_TraceLine( WorldSpaceCenter(), pEntity->WorldSpaceCenter(), MASK_BLOCKLOS, pEntity, COLLISION_GROUP_NONE, &tr );
if (tr.fraction == 1.0 && !tr.startsolid)