Skip to content

Commit

Permalink
Fix crab synths dying in one hit from "sneak attacks"
Browse files Browse the repository at this point in the history
  • Loading branch information
Blixibon committed Oct 23, 2023
1 parent 9d722e4 commit 9d17c76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sp/src/game/server/ai_basehumanoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void CAI_BaseHumanoid::TraceAttack( const CTakeDamageInfo &info, const Vector &v
{
bool bSneakAttacked = false;

if( ptr->hitgroup == HITGROUP_HEAD )
if( ptr->hitgroup == HITGROUP_HEAD && CanBeSneakAttacked( info, vecDir, ptr ) )
{
if ( info.GetAttacker() && info.GetAttacker()->IsPlayer() && info.GetAttacker() != GetEnemy() && !IsInAScript() )
{
Expand Down
3 changes: 3 additions & 0 deletions sp/src/game/server/ai_basehumanoid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class CAI_BaseHumanoid : public CAI_BaseHumanoidBase

// Purpose: check ammo
virtual void CheckAmmo( void );

// Whether or not we can die in one hit from a sneak attack
virtual bool CanBeSneakAttacked( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { return true; }
};

//-----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/server/ez2/npc_crabsynth.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class CNPC_CrabSynth : public CAI_GrenadeUser< CAI_BaseActor >

const char *GetSquadSlotDebugName( int iSquadSlot );

bool CanBeSneakAttacked( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { return false; }

void UpdateOnRemove( void );

virtual CSprite *GetGlowSpritePtr( int i );
Expand Down

0 comments on commit 9d17c76

Please sign in to comment.