mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-03-27 21:09:03 +03:00
Merge pull request #312 from Wikot235/Zombie_improved
Minor npc_zombie improvements
This commit is contained in:
commit
8ef090c963
@ -211,6 +211,9 @@ BEGIN_DATADESC( CNPC_BaseZombie )
|
||||
DEFINE_FIELD( m_fIsTorso, FIELD_BOOLEAN ),
|
||||
#ifdef MAPBASE
|
||||
DEFINE_KEYFIELD( m_fIsHeadless, FIELD_BOOLEAN, "Headless" ),
|
||||
DEFINE_KEYFIELD( m_flMeleeReach, FIELD_FLOAT, "MeleeReach" ),
|
||||
DEFINE_KEYFIELD( m_flMaxDistToSwat, FIELD_FLOAT, "MaxDistToSwat" ),
|
||||
DEFINE_KEYFIELD( m_iMaxObjMassToSwat, FIELD_INTEGER, "MaxObjMassToSwat" ),
|
||||
#else
|
||||
DEFINE_FIELD( m_fIsHeadless, FIELD_BOOLEAN ),
|
||||
#endif
|
||||
@ -256,6 +259,12 @@ CNPC_BaseZombie::CNPC_BaseZombie()
|
||||
// moan loop.
|
||||
m_iMoanSound = g_numZombies;
|
||||
|
||||
#ifdef MAPBASE
|
||||
m_flMeleeReach = ZOMBIE_MELEE_REACH;
|
||||
m_flMaxDistToSwat = ZOMBIE_PLAYER_MAX_SWAT_DIST;
|
||||
m_iMaxObjMassToSwat = ZOMBIE_MAX_PHYSOBJ_MASS;
|
||||
#endif
|
||||
|
||||
g_numZombies++;
|
||||
}
|
||||
|
||||
@ -295,7 +304,11 @@ bool CNPC_BaseZombie::FindNearestPhysicsObject( int iMaxMass )
|
||||
float dist = VectorNormalize(vecDirToEnemy);
|
||||
vecDirToEnemy.z = 0;
|
||||
|
||||
if( dist > ZOMBIE_PLAYER_MAX_SWAT_DIST )
|
||||
#ifndef MAPBASE
|
||||
if (dist > ZOMBIE_PLAYER_MAX_SWAT_DIST)
|
||||
#else
|
||||
if (dist > m_flMaxDistToSwat)
|
||||
#endif
|
||||
{
|
||||
// Player is too far away. Don't bother
|
||||
// trying to swat anything at them until
|
||||
@ -786,7 +799,7 @@ bool CNPC_BaseZombie::ShouldBecomeTorso( const CTakeDamageInfo &info, float flDa
|
||||
HeadcrabRelease_t CNPC_BaseZombie::ShouldReleaseHeadcrab( const CTakeDamageInfo &info, float flDamageThreshold )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
if ( m_iHealth <= 0 && !m_fIsHeadless )
|
||||
if ( m_iHealth <= 0 && !m_fIsHeadless && !HasSpawnFlags(SF_ZOMBIE_NO_HEADCRAB_SPAWN))
|
||||
#else
|
||||
if ( m_iHealth <= 0 )
|
||||
#endif
|
||||
@ -2154,7 +2167,11 @@ void CNPC_BaseZombie::GatherConditions( void )
|
||||
// between him and the object he's heading for already.
|
||||
if( gpGlobals->curtime >= m_flNextSwatScan && (m_hPhysicsEnt == NULL) )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
FindNearestPhysicsObject(m_iMaxObjMassToSwat);
|
||||
#else
|
||||
FindNearestPhysicsObject( ZOMBIE_MAX_PHYSOBJ_MASS );
|
||||
#endif
|
||||
m_flNextSwatScan = gpGlobals->curtime + 2.0;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ extern int AE_ZOMBIE_POUND;
|
||||
#define ZOMBIE_BLOOD_BITE 3
|
||||
|
||||
#ifdef MAPBASE
|
||||
#define SF_ZOMBIE_NO_TORSO ( 1 << 15 )
|
||||
#define SF_ZOMBIE_NO_TORSO ( 1 << 15 )
|
||||
#define SF_ZOMBIE_NO_HEADCRAB_SPAWN ( 1 << 16 )
|
||||
#endif
|
||||
|
||||
|
||||
@ -141,7 +142,14 @@ public:
|
||||
}
|
||||
|
||||
int MeleeAttack1Conditions ( float flDot, float flDist );
|
||||
virtual float GetClawAttackRange() const { return ZOMBIE_MELEE_REACH; }
|
||||
virtual float GetClawAttackRange() const
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
return m_flMeleeReach;
|
||||
#else
|
||||
return ZOMBIE_MELEE_REACH;
|
||||
#endif
|
||||
}
|
||||
|
||||
// No range attacks
|
||||
int RangeAttack1Conditions ( float flDot, float flDist ) { return( 0 ); }
|
||||
@ -257,6 +265,12 @@ protected:
|
||||
|
||||
float m_flNextFlinch;
|
||||
|
||||
#ifdef MAPBASE
|
||||
float m_flMeleeReach;
|
||||
float m_flMaxDistToSwat;
|
||||
int m_iMaxObjMassToSwat;
|
||||
#endif
|
||||
|
||||
bool m_bHeadShot; // Used to determine the survival of our crab beyond our death.
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user