mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-03-30 22:39: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 ),
|
DEFINE_FIELD( m_fIsTorso, FIELD_BOOLEAN ),
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
DEFINE_KEYFIELD( m_fIsHeadless, FIELD_BOOLEAN, "Headless" ),
|
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
|
#else
|
||||||
DEFINE_FIELD( m_fIsHeadless, FIELD_BOOLEAN ),
|
DEFINE_FIELD( m_fIsHeadless, FIELD_BOOLEAN ),
|
||||||
#endif
|
#endif
|
||||||
@ -256,6 +259,12 @@ CNPC_BaseZombie::CNPC_BaseZombie()
|
|||||||
// moan loop.
|
// moan loop.
|
||||||
m_iMoanSound = g_numZombies;
|
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++;
|
g_numZombies++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +304,11 @@ bool CNPC_BaseZombie::FindNearestPhysicsObject( int iMaxMass )
|
|||||||
float dist = VectorNormalize(vecDirToEnemy);
|
float dist = VectorNormalize(vecDirToEnemy);
|
||||||
vecDirToEnemy.z = 0;
|
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
|
// Player is too far away. Don't bother
|
||||||
// trying to swat anything at them until
|
// 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 )
|
HeadcrabRelease_t CNPC_BaseZombie::ShouldReleaseHeadcrab( const CTakeDamageInfo &info, float flDamageThreshold )
|
||||||
{
|
{
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
if ( m_iHealth <= 0 && !m_fIsHeadless )
|
if ( m_iHealth <= 0 && !m_fIsHeadless && !HasSpawnFlags(SF_ZOMBIE_NO_HEADCRAB_SPAWN))
|
||||||
#else
|
#else
|
||||||
if ( m_iHealth <= 0 )
|
if ( m_iHealth <= 0 )
|
||||||
#endif
|
#endif
|
||||||
@ -2154,7 +2167,11 @@ void CNPC_BaseZombie::GatherConditions( void )
|
|||||||
// between him and the object he's heading for already.
|
// between him and the object he's heading for already.
|
||||||
if( gpGlobals->curtime >= m_flNextSwatScan && (m_hPhysicsEnt == NULL) )
|
if( gpGlobals->curtime >= m_flNextSwatScan && (m_hPhysicsEnt == NULL) )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
FindNearestPhysicsObject(m_iMaxObjMassToSwat);
|
||||||
|
#else
|
||||||
FindNearestPhysicsObject( ZOMBIE_MAX_PHYSOBJ_MASS );
|
FindNearestPhysicsObject( ZOMBIE_MAX_PHYSOBJ_MASS );
|
||||||
|
#endif
|
||||||
m_flNextSwatScan = gpGlobals->curtime + 2.0;
|
m_flNextSwatScan = gpGlobals->curtime + 2.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ extern int AE_ZOMBIE_POUND;
|
|||||||
#define ZOMBIE_BLOOD_BITE 3
|
#define ZOMBIE_BLOOD_BITE 3
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +142,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int MeleeAttack1Conditions ( float flDot, float flDist );
|
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
|
// No range attacks
|
||||||
int RangeAttack1Conditions ( float flDot, float flDist ) { return( 0 ); }
|
int RangeAttack1Conditions ( float flDot, float flDist ) { return( 0 ); }
|
||||||
@ -257,6 +265,12 @@ protected:
|
|||||||
|
|
||||||
float m_flNextFlinch;
|
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.
|
bool m_bHeadShot; // Used to determine the survival of our crab beyond our death.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user