mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-06 02:30:40 +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();
|
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
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -51,6 +51,8 @@ public:
|
|||||||
void PrescheduleThink();
|
void PrescheduleThink();
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
bool IsInterruptable( void );
|
bool IsInterruptable( void );
|
||||||
|
|
||||||
|
bool CanManTank( CFuncTank *pTank, bool bForced );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Activity NPC_TranslateActivity( Activity activity );
|
Activity NPC_TranslateActivity( Activity activity );
|
||||||
|
@ -402,7 +402,11 @@ void CFuncTank::InputFindNPCToManTank( inputdata_t &inputdata )
|
|||||||
{
|
{
|
||||||
// Verify the npc has the func_tank controller behavior.
|
// Verify the npc has the func_tank controller behavior.
|
||||||
CAI_FuncTankBehavior *pBehavior;
|
CAI_FuncTankBehavior *pBehavior;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||||
|
#else
|
||||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_hController = pNPC;
|
m_hController = pNPC;
|
||||||
pBehavior->SetFuncTank( this );
|
pBehavior->SetFuncTank( this );
|
||||||
@ -439,7 +443,7 @@ void CFuncTank::InputTeleportNPCToManTank( inputdata_t &inputdata )
|
|||||||
{
|
{
|
||||||
// Verify the npc has the func_tank controller behavior.
|
// Verify the npc has the func_tank controller behavior.
|
||||||
CAI_FuncTankBehavior *pBehavior;
|
CAI_FuncTankBehavior *pBehavior;
|
||||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||||
{
|
{
|
||||||
Vector vecVec;
|
Vector vecVec;
|
||||||
QAngle angAng;
|
QAngle angAng;
|
||||||
@ -512,7 +516,7 @@ void CFuncTank::InputForceNPCToManTank( inputdata_t &inputdata )
|
|||||||
{
|
{
|
||||||
// Verify the npc has the func_tank controller behavior.
|
// Verify the npc has the func_tank controller behavior.
|
||||||
CAI_FuncTankBehavior *pBehavior;
|
CAI_FuncTankBehavior *pBehavior;
|
||||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, true ) )
|
||||||
{
|
{
|
||||||
// Set the forced condition
|
// Set the forced condition
|
||||||
pBehavior->SetCondition( CAI_FuncTankBehavior::COND_FUNCTANK_FORCED );
|
pBehavior->SetCondition( CAI_FuncTankBehavior::COND_FUNCTANK_FORCED );
|
||||||
@ -627,7 +631,11 @@ void CFuncTank::NPC_FindController( void )
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
CAI_FuncTankBehavior *pBehavior;
|
CAI_FuncTankBehavior *pBehavior;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( pNPC->GetBehavior( &pBehavior ) && pBehavior->CanManTank( this, false ) )
|
||||||
|
#else
|
||||||
if ( pNPC->GetBehavior( &pBehavior ) )
|
if ( pNPC->GetBehavior( &pBehavior ) )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// Don't mount the func_tank if your "enemy" is within X feet or it or the npc.
|
// Don't mount the func_tank if your "enemy" is within X feet or it or the npc.
|
||||||
CBaseEntity *pEnemy = pNPC->GetEnemy();
|
CBaseEntity *pEnemy = pNPC->GetEnemy();
|
||||||
|
@ -321,7 +321,9 @@ CNPC_Alyx *CNPC_Alyx::GetAlyx( void )
|
|||||||
//=========================================================
|
//=========================================================
|
||||||
bool CNPC_Alyx::CreateBehaviors()
|
bool CNPC_Alyx::CreateBehaviors()
|
||||||
{
|
{
|
||||||
|
#ifndef MAPBASE // Moved to CNPC_PlayerCompanion
|
||||||
AddBehavior( &m_FuncTankBehavior );
|
AddBehavior( &m_FuncTankBehavior );
|
||||||
|
#endif
|
||||||
bool result = BaseClass::CreateBehaviors();
|
bool result = BaseClass::CreateBehaviors();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -235,7 +235,9 @@ private:
|
|||||||
|
|
||||||
bool m_bShouldHaveEMP;
|
bool m_bShouldHaveEMP;
|
||||||
|
|
||||||
|
#ifndef MAPBASE // Moved to CNPC_PlayerCompanion
|
||||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||||
|
#endif
|
||||||
|
|
||||||
COutputEvent m_OnFinishInteractWithObject;
|
COutputEvent m_OnFinishInteractWithObject;
|
||||||
COutputEvent m_OnPlayerUse;
|
COutputEvent m_OnPlayerUse;
|
||||||
|
@ -439,10 +439,11 @@ CSimpleSimTimer CNPC_Citizen::gm_PlayerSquadEvaluateTimer;
|
|||||||
bool CNPC_Citizen::CreateBehaviors()
|
bool CNPC_Citizen::CreateBehaviors()
|
||||||
{
|
{
|
||||||
BaseClass::CreateBehaviors();
|
BaseClass::CreateBehaviors();
|
||||||
AddBehavior( &m_FuncTankBehavior );
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
AddBehavior( &m_RappelBehavior );
|
AddBehavior( &m_RappelBehavior );
|
||||||
AddBehavior( &m_PolicingBehavior );
|
AddBehavior( &m_PolicingBehavior );
|
||||||
|
#else // Moved to CNPC_PlayerCompanion
|
||||||
|
AddBehavior( &m_FuncTankBehavior );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -370,7 +370,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
CAI_FuncTankBehavior m_FuncTankBehavior;
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
CAI_RappelBehavior m_RappelBehavior;
|
CAI_RappelBehavior m_RappelBehavior;
|
||||||
CAI_PolicingBehavior m_PolicingBehavior;
|
CAI_PolicingBehavior m_PolicingBehavior;
|
||||||
@ -378,6 +377,8 @@ private:
|
|||||||
// Rappel
|
// Rappel
|
||||||
virtual bool IsWaitingToRappel( void ) { return m_RappelBehavior.IsWaitingToRappel(); }
|
virtual bool IsWaitingToRappel( void ) { return m_RappelBehavior.IsWaitingToRappel(); }
|
||||||
void BeginRappel() { m_RappelBehavior.BeginRappel(); }
|
void BeginRappel() { m_RappelBehavior.BeginRappel(); }
|
||||||
|
#else // Moved to CNPC_PlayerCompanion
|
||||||
|
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CHandle<CAI_FollowGoal> m_hSavedFollowGoalEnt;
|
CHandle<CAI_FollowGoal> m_hSavedFollowGoalEnt;
|
||||||
|
@ -212,6 +212,10 @@ bool CNPC_PlayerCompanion::CreateBehaviors()
|
|||||||
AddBehavior( &m_LeadBehavior );
|
AddBehavior( &m_LeadBehavior );
|
||||||
#endif//HL2_EPISODIC
|
#endif//HL2_EPISODIC
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
AddBehavior( &m_FuncTankBehavior );
|
||||||
|
#endif
|
||||||
|
|
||||||
return BaseClass::CreateBehaviors();
|
return BaseClass::CreateBehaviors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
|
#include "ai_behavior_functank.h"
|
||||||
#include "mapbase/ai_grenade.h"
|
#include "mapbase/ai_grenade.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -432,6 +433,9 @@ protected:
|
|||||||
CAI_OperatorBehavior m_OperatorBehavior;
|
CAI_OperatorBehavior m_OperatorBehavior;
|
||||||
CAI_PassengerBehaviorCompanion m_PassengerBehavior;
|
CAI_PassengerBehaviorCompanion m_PassengerBehavior;
|
||||||
CAI_FearBehavior m_FearBehavior;
|
CAI_FearBehavior m_FearBehavior;
|
||||||
|
#endif
|
||||||
|
#ifdef MAPBASE
|
||||||
|
CAI_FuncTankBehavior m_FuncTankBehavior;
|
||||||
#endif
|
#endif
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
|
@ -2718,6 +2718,15 @@ void CNPC_Vortigaunt::OnSquishedGrub( const CBaseEntity *pGrub )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CNPC_Vortigaunt::AimGun( void )
|
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 our aim lock is on, don't bother
|
||||||
if ( m_flAimDelay >= gpGlobals->curtime )
|
if ( m_flAimDelay >= gpGlobals->curtime )
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user