Added more customizability

This commit is contained in:
Wikot235 2025-01-06 16:54:54 +01:00
parent 959af0b130
commit 99c94f058b
2 changed files with 22 additions and 5 deletions

View File

@ -85,9 +85,16 @@ envelopePoint_t envDefaultZombieMoanVolume[] =
#define ZOMBIE_FARTHEST_PHYSICS_OBJECT 40.0*12.0
#define ZOMBIE_PHYSICS_SEARCH_DEPTH 100
#ifndef MAPBASE
// Don't swat objects unless player is closer than this.
#define ZOMBIE_PLAYER_MAX_SWAT_DIST 1000
// The heaviest physics object that a zombie should try to swat. (kg)
#define ZOMBIE_MAX_PHYSOBJ_MASS 60
#endif
//
// How much health a Zombie torso gets when a whole zombie is broken
// It's whole zombie's MAX Health * this value
@ -98,10 +105,6 @@ envelopePoint_t envDefaultZombieMoanVolume[] =
// try to release its headcrab.
#define ZOMBIE_RELEASE_HEALTH_FACTOR 0.5
//
// The heaviest physics object that a zombie should try to swat. (kg)
#define ZOMBIE_MAX_PHYSOBJ_MASS 60
//
// Zombie tries to get this close to a physics object's origin to swat it
#define ZOMBIE_PHYSOBJ_SWATDIST 80
@ -212,6 +215,8 @@ BEGIN_DATADESC( CNPC_BaseZombie )
#ifdef MAPBASE
DEFINE_KEYFIELD( m_fIsHeadless, FIELD_BOOLEAN, "Headless" ),
DEFINE_KEYFIELD( m_iMeleeReach, FIELD_INTEGER, "MeleeReach" ),
DEFINE_KEYFIELD( m_iMaxPlayerDistToSwat, FIELD_INTEGER, "MaxPlayerDistToSwat" ),
DEFINE_KEYFIELD( m_iMaxObjWeightToSwat, FIELD_INTEGER, "MaxObjWeightToSwat" ),
#else
DEFINE_FIELD( m_fIsHeadless, FIELD_BOOLEAN ),
#endif
@ -259,6 +264,8 @@ CNPC_BaseZombie::CNPC_BaseZombie()
#ifdef MAPBASE
m_iMeleeReach = 55;
m_iMaxPlayerDistToSwat = 1000;
m_iMaxObjWeightToSwat = 60;
#endif
g_numZombies++;
@ -300,7 +307,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_iMaxPlayerDistToSwat)
#endif
{
// Player is too far away. Don't bother
// trying to swat anything at them until
@ -2159,7 +2170,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_iMaxObjWeightToSwat );
#else
FindNearestPhysicsObject( ZOMBIE_MAX_PHYSOBJ_MASS );
#endif
m_flNextSwatScan = gpGlobals->curtime + 2.0;
}
}

View File

@ -269,6 +269,8 @@ protected:
#ifdef MAPBASE
int m_iMeleeReach;
int m_iMaxPlayerDistToSwat;
int m_iMaxObjWeightToSwat;
#endif
bool m_bHeadShot; // Used to determine the survival of our crab beyond our death.