mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-27 14:17:59 +03:00
Added func_tank behavior to vortigaunts and Barney
This commit is contained in:
parent
a5c0091588
commit
65478e754d
@ -110,6 +110,28 @@ bool CAI_FuncTankBehavior::IsInterruptable( void )
|
||||
|
||||
return BaseClass::IsInterruptable();
|
||||
}
|
||||
|
||||
ConVar ai_tank_allow_expanded_npcs( "ai_tank_allow_expanded_npcs", "1", FCVAR_NONE, "Allows Father Grigori, Barney, and vortigaunts to automatically man func_tanks." );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAI_FuncTankBehavior::CanManTank( CFuncTank *pTank, bool bForced )
|
||||
{
|
||||
if (!bForced)
|
||||
{
|
||||
// In order to prevent potential problems in existing maps, Father Grigori, Barney, and vortigaunts can be set to not automatically man func_tanks by default.
|
||||
if (ai_tank_allow_expanded_npcs.GetBool() == false)
|
||||
{
|
||||
const char *pszClass = GetOuter()->GetClassname();
|
||||
if ( FStrEq( pszClass, "npc_monk" ) || FStrEq( pszClass, "npc_barney" ) || FStrEq( pszClass, "npc_vortigaunt" ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
void PrescheduleThink();
|
||||
#ifdef MAPBASE
|
||||
bool IsInterruptable( void );
|
||||
|
||||
bool CanManTank( CFuncTank *pTank, bool bForced );
|
||||
#endif
|
||||
|
||||
Activity NPC_TranslateActivity( Activity activity );
|
||||
|
@ -402,7 +402,11 @@ void CFuncTank::InputFindNPCToManTank( inputdata_t &inputdata )
|
||||
{
|
||||
// Verify the npc has the func_tank controller behavior.
|
||||
CAI_FuncTankBehavior *pBehavior;
|
||||
#ifdef MAPBASE
|
||||
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||
#else
|
||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||
#endif
|
||||
{
|
||||
m_hController = pNPC;
|
||||
pBehavior->SetFuncTank( this );
|
||||
@ -439,7 +443,7 @@ void CFuncTank::InputTeleportNPCToManTank( inputdata_t &inputdata )
|
||||
{
|
||||
// Verify the npc has the func_tank controller behavior.
|
||||
CAI_FuncTankBehavior *pBehavior;
|
||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||
{
|
||||
Vector vecVec;
|
||||
QAngle angAng;
|
||||
@ -512,7 +516,7 @@ void CFuncTank::InputForceNPCToManTank( inputdata_t &inputdata )
|
||||
{
|
||||
// Verify the npc has the func_tank controller behavior.
|
||||
CAI_FuncTankBehavior *pBehavior;
|
||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||
{
|
||||
// Set the forced condition
|
||||
pBehavior->SetCondition( CAI_FuncTankBehavior::COND_FUNCTANK_FORCED );
|
||||
@ -627,7 +631,11 @@ void CFuncTank::NPC_FindController( void )
|
||||
continue;
|
||||
|
||||
CAI_FuncTankBehavior *pBehavior;
|
||||
#ifdef MAPBASE
|
||||
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, false ) )
|
||||
#else
|
||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||
#endif
|
||||
{
|
||||
// Don't mount the func_tank if your "enemy" is within X feet or it or the npc.
|
||||
CBaseEntity *pEnemy = pNPC->GetEnemy();
|
||||
|
@ -321,7 +321,9 @@ CNPC_Alyx *CNPC_Alyx::GetAlyx( void )
|
||||
//=========================================================
|
||||
bool CNPC_Alyx::CreateBehaviors()
|
||||
{
|
||||
#ifndef MAPBASE // Moved to CNPC_PlayerCompanion
|
||||
AddBehavior( &m_FuncTankBehavior );
|
||||
#endif
|
||||
bool result = BaseClass::CreateBehaviors();
|
||||
|
||||
return result;
|
||||
|
@ -235,7 +235,9 @@ private:
|
||||
|
||||
bool m_bShouldHaveEMP;
|
||||
|
||||
#ifndef MAPBASE // Moved to CNPC_PlayerCompanion
|
||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||
#endif
|
||||
|
||||
COutputEvent m_OnFinishInteractWithObject;
|
||||
COutputEvent m_OnPlayerUse;
|
||||
|
@ -439,10 +439,11 @@ CSimpleSimTimer CNPC_Citizen::gm_PlayerSquadEvaluateTimer;
|
||||
bool CNPC_Citizen::CreateBehaviors()
|
||||
{
|
||||
BaseClass::CreateBehaviors();
|
||||
AddBehavior( &m_FuncTankBehavior );
|
||||
#ifdef MAPBASE
|
||||
AddBehavior( &m_RappelBehavior );
|
||||
AddBehavior( &m_PolicingBehavior );
|
||||
#else // Moved to CNPC_PlayerCompanion
|
||||
AddBehavior( &m_FuncTankBehavior );
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -370,7 +370,6 @@ private:
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------
|
||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||
#ifdef MAPBASE
|
||||
CAI_RappelBehavior m_RappelBehavior;
|
||||
CAI_PolicingBehavior m_PolicingBehavior;
|
||||
@ -378,6 +377,8 @@ private:
|
||||
// Rappel
|
||||
virtual bool IsWaitingToRappel( void ) { return m_RappelBehavior.IsWaitingToRappel(); }
|
||||
void BeginRappel() { m_RappelBehavior.BeginRappel(); }
|
||||
#else // Moved to CNPC_PlayerCompanion
|
||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||
#endif
|
||||
|
||||
CHandle<CAI_FollowGoal> m_hSavedFollowGoalEnt;
|
||||
|
@ -211,6 +211,10 @@ bool CNPC_PlayerCompanion::CreateBehaviors()
|
||||
AddBehavior( &m_FollowBehavior );
|
||||
AddBehavior( &m_LeadBehavior );
|
||||
#endif//HL2_EPISODIC
|
||||
|
||||
#ifdef MAPBASE
|
||||
AddBehavior( &m_FuncTankBehavior );
|
||||
#endif
|
||||
|
||||
return BaseClass::CreateBehaviors();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE
|
||||
#include "ai_behavior_functank.h"
|
||||
#include "mapbase/ai_grenade.h"
|
||||
#endif
|
||||
|
||||
@ -432,6 +433,9 @@ protected:
|
||||
CAI_OperatorBehavior m_OperatorBehavior;
|
||||
CAI_PassengerBehaviorCompanion m_PassengerBehavior;
|
||||
CAI_FearBehavior m_FearBehavior;
|
||||
#endif
|
||||
#ifdef MAPBASE
|
||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||
#endif
|
||||
//-----------------------------------------------------
|
||||
|
||||
|
@ -2718,6 +2718,15 @@ void CNPC_Vortigaunt::OnSquishedGrub( const CBaseEntity *pGrub )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CNPC_Vortigaunt::AimGun( void )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
// Use base for func_tank
|
||||
if (m_FuncTankBehavior.IsRunning())
|
||||
{
|
||||
BaseClass::AimGun();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If our aim lock is on, don't bother
|
||||
if ( m_flAimDelay >= gpGlobals->curtime )
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user