Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions sp/src/game/server/hl2/npc_BaseZombie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ ConVar zombie_decaymax( "zombie_decaymax", "0.4" );

ConVar zombie_ambushdist( "zombie_ambushdist", "16000" );

#ifdef MAPBASE
ConVar zombie_no_flinch_during_unique_anim( "zombie_no_flinch_during_unique_anim", "1", FCVAR_NONE, "Prevents zombies from flinching during actbusies and scripted sequences." );
#endif

//=========================================================
// For a couple of reasons, we keep a running count of how
// many zombies in the world are angry at any given time.
Expand Down Expand Up @@ -1927,6 +1931,31 @@ void CNPC_BaseZombie::OnScheduleChange( void )
}


//---------------------------------------------------------
//---------------------------------------------------------

bool CNPC_BaseZombie::CanFlinch( void )
{
if (!BaseClass::CanFlinch())
return false;

#ifdef MAPBASE
if (zombie_no_flinch_during_unique_anim.GetBool())
{
// Don't flinch if currently playing actbusy animation (navigating to or from one is fine)
if (m_ActBusyBehavior.IsInsideActBusy())
return false;

// Don't flinch if currently playing scripted sequence (navigating to or from one is fine)
if (m_NPCState == NPC_STATE_SCRIPT && (IsCurSchedule( SCHED_SCRIPTED_WAIT, false ) || IsCurSchedule( SCHED_SCRIPTED_FACE, false )))
return false;
}
#endif

return true;
}


//---------------------------------------------------------
//---------------------------------------------------------
int CNPC_BaseZombie::SelectFailSchedule( int failedSchedule, int failedTask, AI_TaskFailureCode_t taskFailCode )
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/server/hl2/npc_BaseZombie.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ abstract_class CNPC_BaseZombie : public CAI_BaseZombieBase
int OnTakeDamage_Alive( const CTakeDamageInfo &info );
virtual float GetReactionDelay( CBaseEntity *pEnemy ) { return 0.0; }

bool CanFlinch( void );

virtual int SelectSchedule ( void );
virtual int SelectFailSchedule( int failedSchedule, int failedTask, AI_TaskFailureCode_t taskFailCode );
virtual void BuildScheduleTestBits( void );
Expand Down