mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-26 21:57:57 +03:00
Merge pull request #292 from arbabf/develop
Add random spawn type for env_headcrabcanister
This commit is contained in:
commit
7220a6de28
@ -33,6 +33,9 @@ ConVar sk_env_headcrabcanister_shake_radius( "sk_env_headcrabcanister_shake_radi
|
||||
ConVar sk_env_headcrabcanister_shake_radius_vehicle( "sk_env_headcrabcanister_shake_radius_vehicle", "2500" );
|
||||
|
||||
#define ENV_HEADCRABCANISTER_TRAIL_TIME 3.0f
|
||||
#ifdef MAPBASE
|
||||
#define RANDOM_CRAB_TYPE -1
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Spawn flags
|
||||
@ -258,7 +261,22 @@ void CEnvHeadcrabCanister::Precache( void )
|
||||
PrecacheScriptSound( "HeadcrabCanister.SkyboxExplosion" );
|
||||
PrecacheScriptSound( "HeadcrabCanister.Open" );
|
||||
|
||||
#ifdef MAPBASE
|
||||
if ( m_nHeadcrabType != RANDOM_CRAB_TYPE )
|
||||
{
|
||||
UTIL_PrecacheOther( s_pHeadcrabClass[m_nHeadcrabType] );
|
||||
}
|
||||
else
|
||||
{
|
||||
// precache all the headcrabs if we're spawning random species
|
||||
for ( int i = 0; i < ARRAYSIZE( s_pHeadcrabClass ); i++ )
|
||||
{
|
||||
UTIL_PrecacheOther( s_pHeadcrabClass[i] );
|
||||
}
|
||||
}
|
||||
#else
|
||||
UTIL_PrecacheOther( s_pHeadcrabClass[m_nHeadcrabType] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -733,7 +751,17 @@ void CEnvHeadcrabCanister::HeadcrabCanisterSpawnHeadcrabThink()
|
||||
int nHeadCrabAttachment = LookupAttachment( "headcrab" );
|
||||
if ( GetAttachment( nHeadCrabAttachment, vecSpawnPosition, vecSpawnAngles ) )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
int iHeadcrabType = m_nHeadcrabType;
|
||||
if ( m_nHeadcrabType == RANDOM_CRAB_TYPE )
|
||||
{
|
||||
iHeadcrabType = RandomInt( 0, ARRAYSIZE( s_pHeadcrabClass ) - 1 );
|
||||
}
|
||||
|
||||
CBaseEntity *pEnt = CreateEntityByName( s_pHeadcrabClass[iHeadcrabType] );
|
||||
#else
|
||||
CBaseEntity *pEnt = CreateEntityByName( s_pHeadcrabClass[m_nHeadcrabType] );
|
||||
#endif
|
||||
CBaseHeadcrab *pHeadCrab = assert_cast<CBaseHeadcrab*>(pEnt);
|
||||
|
||||
// Necessary to get it to eject properly (don't allow the NPC
|
||||
|
Loading…
x
Reference in New Issue
Block a user