Example #1
0
void CFriend::Killed( entvars_t *pevAttacker, int iGib )
{
//used a event

	SetUse( NULL );	
	CTalkMonster::Killed( pevAttacker, iGib );
}
Example #2
0
void CLeech::Spawn( void )
{
	Precache();
	SET_MODEL(ENT(pev), "models/leech.mdl");
	// Just for fun
	//	SET_MODEL(ENT(pev), "models/icky.mdl");
	
//	UTIL_SetSize( pev, g_vecZero, g_vecZero );
	UTIL_SetSize( pev, Vector(-1,-1,0), Vector(1,1,2));
	// Don't push the minz down too much or the water check will fail because this entity is really point-sized
	pev->solid			= SOLID_SLIDEBOX;
	pev->movetype		= MOVETYPE_FLY;
	SetBits(pev->flags, FL_SWIM);
	pev->health			= gSkillData.leechHealth;

	m_flFieldOfView		= -0.5;	// 180 degree FOV
	m_flDistLook		= 750;
	MonsterInit();
	SetThink( &CLeech::SwimThink );
	SetUse( NULL );
	SetTouch( NULL );
	pev->view_ofs = g_vecZero;

	m_flTurning = 0;
	m_fPathBlocked = FALSE;
	SetActivity( ACT_SWIM );
	SetState( MONSTERSTATE_IDLE );
	m_stateTime = gpGlobals->time + RANDOM_FLOAT( 1, 5 );
}
Example #3
0
bool AvHHive::StartSpawningForTeam(AvHTeamNumber inTeam, bool inForce)
{
	bool theSuccess = false;

	if(this->SetSolid(inForce))
	{
		this->pev->team = inTeam;
		this->pev->takedamage = DAMAGE_YES;

		this->pev->rendermode = kRenderNormal;
		this->pev->renderamt = 0;
		
		SetBits(pev->flags, FL_MONSTER);
		SetUpgradeMask(&this->pev->iuser4, MASK_BUILDABLE);
		
		this->mSpawning = true;
		this->pev->health = kBaseHealthPercentage*this->mBaseHealth;

		// Looping, growing animation
		this->pev->sequence	= 0;
		this->pev->frame = 0;
		ResetSequenceInfo();

		this->pev->nextthink = gpGlobals->time + kHiveAliveThinkInterval;
		SetThink(&AvHHive::HiveAliveThink);
		SetUse(&AvHHive::TeleportUse);

		theSuccess = true;
	}

	return theSuccess;
}
// create ourselves a particle emitter
void CParticleEmitter::Spawn( void )
{
	pev->solid = SOLID_NOT;
	pev->movetype = MOVETYPE_NONE;
	SET_MODEL (ENT(pev), STRING(pev->model));
	pev->effects |= EF_NODRAW;
	
	UTIL_SetOrigin( pev, pev->origin ); 		
	UTIL_SetSize( pev, pev->absmin, pev->absmax );

    SetUse ( &CParticleEmitter::Use );

	if (pev->spawnflags & SF_START_ON)
	{
		ALERT (at_console, "CParticleEmitter Spawn in <ON> Mode\nNextthink in 0.5 Seconds\n");

		bIsOn = true;
		iID = ++iParticleIDCount;

		SetThink( &CParticleEmitter::TurnOn );
		pev->nextthink = gpGlobals->time + 0.5;
	}
	else
	{
		bIsOn = false;
	}

	IsTriggered(NULL);
	iID = ++iParticleIDCount;
	flTimeTurnedOn = 0.0;
}
Example #5
0
void CBaseTurret::Spawn()
{ 
	Precache( );
	pev->nextthink		= gpGlobals->time + 1;
	pev->movetype		= MOVETYPE_FLY;
	pev->sequence		= 0;
	pev->frame			= 0;
	pev->solid			= SOLID_SLIDEBOX;
	pev->takedamage		= DAMAGE_AIM;

	SetBits (pev->flags, FL_MONSTER);
	SetUse(&CBaseTurret::TurretUse );

	if (( pev->spawnflags & SF_MONSTER_TURRET_AUTOACTIVATE ) 
		 && !( pev->spawnflags & SF_MONSTER_TURRET_STARTINACTIVE ))
	{
		m_iAutoStart = TRUE;
	}

	ResetSequenceInfo( );
	SetBoneController( 0, 0 );
	SetBoneController( 1, 0 );
	m_flFieldOfView = VIEW_FIELD_FULL;
	// m_flSightRange = this->GetRange();
}
Example #6
0
//-----------------------------------------------------------------------------
// Purpose: Called when spawning, after keyvalues have been handled.
//-----------------------------------------------------------------------------
void CEnvSpark::Spawn(void)
{
	SetThink( NULL );
	SetUse( NULL );

	if ( FBitSet(m_spawnflags, SF_SPARK_START_ON ) )
	{
		SetThink( &CEnvSpark::SparkThink );	// start sparking
	}

	SetNextThink( gpGlobals->curtime + 0.1 + random->RandomFloat( 0, 1.5 ) );

	// Negative delays are not allowed
	if ( m_flDelay < 0 )
	{
		m_flDelay = 0;
	}

#ifdef HL1_DLL
	// Don't allow 0 delays in HL1 Port. Enforce a default
	if( m_flDelay == 0 )
	{
		m_flDelay = 1.0f;
	}
#endif//HL1_DLL
	
	Precache( );
}
void CSatchelCharge::Spawn( void )
{
	Precache( );
	// motor
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX ); 
	SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
	SetModel( "models/Weapons/w_slam.mdl" );

	UTIL_SetSize(this, Vector( -6, -6, -2), Vector(6, 6, 2));

	SetTouch( SatchelTouch );
	SetUse( SatchelUse );
	SetThink( SatchelThink );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_satchel.GetFloat();
	m_DmgRadius		= sk_satchel_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( 560 ) );	// slightly lower gravity
	SetFriction( 1.0 );
	SetSequence( 1 );

	m_bIsAttached			= false;
	m_bInAir				= true;
	m_flSlideVolume			= -1.0;
	m_flNextBounceSoundTime	= 0;

	m_vLastPosition	= vec3_origin;

	InitSlideSound();
}
Example #8
0
void CGrenadeMP5::Spawn( void )
{
	Precache( );
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_FLY );
	AddFlag( FL_GRENADE );

	SetModel( "models/grenade.mdl" );
	//UTIL_SetSize(this, Vector(-3, -3, -3), Vector(3, 3, 3));
	UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));

	SetUse( &CBaseGrenade::DetonateUse );
	SetTouch( &CGrenadeMP5::GrenadeMP5Touch );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_plr_dmg_mp5_grenade.GetFloat();
	m_DmgRadius		= sk_mp5_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_bIsLive		= true;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( 400 ) );	// use a lower gravity for grenades to make them easier to see
	SetFriction( 0.8 );

	SetSequence( 0 );

	m_fSpawnTime	= gpGlobals->curtime;
}
void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	SetThink(&CApache:: HuntThink );
	SetTouch(&CApache:: FlyTouch );
	SetNextThink( 0.1 );
	SetUse( NULL );
}
Example #10
0
//=========================================================
// Spawn
//=========================================================
void CBarney :: Spawn()
{
	Precache( );

	if (pev->model)
		SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
	else
		SET_MODEL(ENT(pev), "models/barney.mdl");
	UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);

	pev->solid			= SOLID_SLIDEBOX;
	pev->movetype		= MOVETYPE_STEP;
	m_bloodColor		= BLOOD_COLOR_RED;
	if (pev->health == 0) //LRC
		pev->health	= gSkillData.barneyHealth;
	pev->view_ofs		= Vector ( 0, 0, 50 );// position of the eyes relative to monster's origin.
	m_flFieldOfView		= VIEW_FIELD_WIDE; // NOTE: we need a wide field of view so npc will notice player and say hello
	m_MonsterState		= MONSTERSTATE_NONE;

	m_iBaseBody = pev->body; //LRC
	pev->body			= m_iBaseBody + BARNEY_BODY_GUNHOLSTERED; // gun in holster
	m_fGunDrawn			= FALSE;

	m_afCapability		= bits_CAP_HEAR | bits_CAP_TURN_HEAD | bits_CAP_DOORS_GROUP;

	MonsterInit();
	SetUse( &CTalkMonster::FollowerUse );
}
Example #11
0
void CNihilanth::StartupThink( void )
{
	m_irritation = 0;
	m_flAdj = 512;

	CBaseEntity *pEntity;

	pEntity = UTIL_FindEntityByTargetname( NULL, "n_min");
	if (pEntity)
		m_flMinZ = pEntity->pev->origin.z;
	else
		m_flMinZ = -4096;

	pEntity = UTIL_FindEntityByTargetname( NULL, "n_max");
	if (pEntity)
		m_flMaxZ = pEntity->pev->origin.z;
	else
		m_flMaxZ = 4096;

	m_hRecharger = this;
	for (int i = 0; i < N_SPHERES; i++)
	{
		EmitSphere( );
	}
	m_hRecharger = NULL;

	SetThink( &CNihilanth::HuntThink);
	SetUse( &CNihilanth::CommandUse );
	pev->nextthink = gpGlobals->time + 0.1;
}
Example #12
0
//=========================================================
// Spawn
//=========================================================
void CIchthyosaur :: Spawn()
{
	Precache( );

	SET_MODEL(ENT(pev), "models/icky.mdl");
	UTIL_SetSize( pev, Vector( -32, -32, -32 ), Vector( 32, 32, 32 ) );

	pev->solid			= SOLID_BBOX;
	pev->movetype		= MOVETYPE_FLY;
	m_bloodColor		= BLOOD_COLOR_GREEN;
	pev->health			= gSkillData.ichthyosaurHealth;
	pev->view_ofs		= Vector ( 0, 0, 16 );
	m_flFieldOfView		= VIEW_FIELD_WIDE;
	m_MonsterState		= MONSTERSTATE_NONE;
	SetBits(pev->flags, FL_SWIM);
	SetFlyingSpeed( ICHTHYOSAUR_SPEED );
	SetFlyingMomentum( 2.5 );	// Set momentum constant

	m_afCapability		= bits_CAP_RANGE_ATTACK1 | bits_CAP_SWIM;

	MonsterInit();

	SetTouch( BiteTouch );
	SetUse( CombatUse );

	m_idealDist = 384;
	m_flMinSpeed = 80;
	m_flMaxSpeed = 300;
	m_flMaxDist = 384;

	Vector Forward;
	UTIL_MakeVectorsPrivate(pev->angles, Forward, 0, 0);
	pev->velocity = m_flightSpeed * Forward.Normalize();
	m_SaveVelocity = pev->velocity;
}
Example #13
0
void CApache::StartupUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	SetThink( HuntThink );
	SetTouch( FlyTouch );
	pev->nextthink = gpGlobals->time + 0.1;
	SetUse( NULL );
}
Example #14
0
void CGrenadeSpit::Spawn( void )
{
	Precache( );
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_FLYGRAVITY );

	// FIXME, if these is a sprite, then we need a base class derived from CSprite rather than
	// CBaseAnimating.  pev->scale becomes m_flSpriteScale in that case.
	SetModel( "models/spitball_large.mdl" );
	UTIL_SetSize(this, Vector(0, 0, 0), Vector(0, 0, 0));

	m_nRenderMode		= kRenderTransAdd;
	SetRenderColor( 255, 255, 255, 255 );
	m_nRenderFX		= kRenderFxNone;

	SetThink( SpitThink );
	SetUse( DetonateUse );
	SetTouch( GrenadeSpitTouch );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage		= sk_dmg_spit_grenade.GetFloat();
	m_DmgRadius		= sk_spit_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetGravity( UTIL_ScaleForGravity( SPIT_GRAVITY ) );
	SetFriction( 0.8 );
	SetSequence( 1 );

	SetCollisionGroup( HL2COLLISION_GROUP_SPIT );
}
Example #15
0
void AvHBaseBuildable::Materialize()
{
	this->pev->solid = SOLID_BBOX;

	this->pev->movetype = this->GetMoveType();
	
	this->pev->classname = MAKE_STRING(this->mClassName);
	
	this->pev->takedamage = DAMAGE_YES;
	SetBits(this->pev->flags, FL_MONSTER);
	
	// Always buildable
	this->InternalInitializeBuildable();
	
	this->SetNormalizedBuildPercentage(0.0f);
	
	// NOTE: fuser2 is used for repairing structures

	Vector theMinSize, theMaxSize;
	//int theSequence = this->GetSequenceForBoundingBox();

	// Get height needed for model
	//this->ExtractBbox(theSequence, (float*)&theMinSize, (float*)&theMaxSize);
	//float theHeight = theMaxSize.z - theMinSize.z;

	AvHSHUGetSizeForTech(this->GetMessageID(), theMinSize, theMaxSize);

	UTIL_SetSize(pev, theMinSize, theMaxSize);

	this->PlayAnimationAtIndex(this->GetSpawnAnimation(), true);
		
	SetUse(&AvHBaseBuildable::ConstructUse);
}
Example #16
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CPointHurt::Spawn(void)
{
    SetThink( NULL );
    SetUse( NULL );

    m_pActivator = NULL;

    if ( HasSpawnFlags( SF_PHURT_START_ON ) )
    {
        SetThink( &CPointHurt::HurtThink );
    }

    SetNextThink( gpGlobals->curtime + 0.1f );

    if ( m_flRadius <= 0.0f )
    {
        m_flRadius = 128.0f;
    }

    if ( m_nDamage <= 0 )
    {
        m_nDamage = 2;
    }

    if ( m_flDelay <= 0 )
    {
        m_flDelay = 0.1f;
    }

    Precache();
}
void CGrenadeEnergy::Spawn( void )
{
	Precache( );
	SetSolid( SOLID_BBOX );
	SetMoveType( MOVETYPE_FLY );

	SetModel( "Models/weapons/w_energy_grenade.mdl" );

	SetUse( &CBaseGrenade::DetonateUse );
	SetTouch( &CGrenadeEnergy::GrenadeEnergyTouch );
	SetNextThink( gpGlobals->curtime + 0.1f );

	m_flDamage			= sk_dmg_energy_grenade.GetFloat();
	m_DmgRadius		= sk_energy_grenade_radius.GetFloat();
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 1;

	SetCycle(0);

	m_flLaunchTime	= gpGlobals->curtime;

	SetCollisionGroup( HL2COLLISION_GROUP_HOUNDEYE ); 

	UTIL_SetSize( this, vec3_origin, vec3_origin );

	m_flMaxFrame = modelinfo->GetModelFrameCount( GetModel() ) - 1;

}
Example #18
0
int CSentry::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
	if ( !pev->takedamage )
		return 0;

//	if (!m_iOn)
//	{
//		SetThink( Deploy );
//		SetUse( NULL );
//		pev->nextthink = gpGlobals->time + 0.1;
//	}

	pev->health -= flDamage;
	if (pev->health <= 0)
	{
		pev->health = 0;
		pev->takedamage = DAMAGE_NO;
		pev->dmgtime = gpGlobals->time;

		ClearBits (pev->flags, FL_MONSTER); // why are they set in the first place???

		SetUse(NULL);
		SetThink(&CSentry::SentryDeath);
		SUB_UseTargets( this, USE_ON, 0 ); // wake up others
		pev->nextthink = gpGlobals->time + 0.1;

		return 0;
	}

	return 1;
}
void CMonsterMaker :: Spawn( )
{
	pev->solid = SOLID_NOT;

	m_cLiveChildren = 0;
	Precache();
	if ( !FStringNull ( pev->targetname ) )
	{
		if ( pev->spawnflags & SF_MONSTERMAKER_CYCLIC )
		{
			SetUse(&CMonsterMaker :: CyclicUse );// drop one monster each time we fire
			m_fActive = FALSE;
		}
		else
		{
			SetUse(&CMonsterMaker :: ToggleUse );// can be turned on/off

			if ( FBitSet ( pev->spawnflags, SF_MONSTERMAKER_START_ON ) )
			{// start making monsters as soon as monstermaker spawns
				m_fActive = TRUE;
				SetThink(&CMonsterMaker :: MakerThink );
			}
			else
			{// wait to be activated.
				m_fActive = FALSE;
				SetThink(&CMonsterMaker :: SUB_DoNothing );
			}
		}
	}
	else
	{// no targetname, just start.
			SetNextThink( m_flDelay );
			m_fActive = TRUE;
			SetThink(&CMonsterMaker :: MakerThink );
	}

	if ( m_cNumMonsters == 1 || (m_cNumMonsters != -1 && pev->spawnflags & SF_MONSTERMAKER_LEAVECORPSE ))
	{
		m_fFadeChildren = FALSE;
	}
	else
	{
		m_fFadeChildren = TRUE;
	}

	m_flGround = 0;
}
Example #20
0
void CRotButton::Spawn( void )
{
	Precache();

	// set the axis of rotation
	AxisDir( pev );

	// check for clockwise rotation
	if( FBitSet( pev->spawnflags, SF_ROTBUTTON_ROTATE_BACKWARDS ))
		pev->movedir = pev->movedir * -1;

	pev->movetype = MOVETYPE_PUSH;
	
	if( FBitSet( pev->spawnflags, SF_ROTBUTTON_PASSABLE ))
		pev->solid = SOLID_NOT;
	else pev->solid = SOLID_BSP;

	// shared code use this flag as BUTTON_DONTMOVE so we need to clear it here
	ClearBits( pev->spawnflags, SF_ROTBUTTON_PASSABLE );
	ClearBits( pev->spawnflags, SF_BUTTON_SPARK_IF_OFF );
	ClearBits( pev->spawnflags, SF_BUTTON_DAMAGED_AT_LASER );

	SET_MODEL( edict(), GetModel() );
	
	if( pev->speed == 0 )
		pev->speed = 40;

	if( m_flWait == 0 )
		m_flWait = 1;

	if( pev->health > 0 )
	{
		pev->takedamage = DAMAGE_YES;
	}

	m_iState = STATE_OFF;
	m_vecAngle1 = GetLocalAngles();
	m_vecAngle2 = GetLocalAngles() + pev->movedir * m_flMoveDistance;

	ASSERTSZ( m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal" );

	m_fStayPushed = (m_flWait == -1) ? TRUE : FALSE;
	m_fRotating = TRUE;

	// if the button is flagged for USE button activation only, take away it's touch function and add a use function
	if( !FBitSet( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ))
	{
		SetTouch( NULL );
		SetUse( &CBaseButton::ButtonUse );
	}
	else
	{	
		// touchable button
		SetTouch( &CBaseButton::ButtonTouch );
	}

	UTIL_SetOrigin( this, GetLocalOrigin( ));
	m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this );
}
Example #21
0
void CMonsterMaker :: Spawn( )
{
	pev->solid = SOLID_NOT;

	m_cLiveChildren = 0;
	Precache();
	if ( !FStringNull ( pev->targetname ) )
	{
		if ( pev->spawnflags & SF_MONSTERMAKER_CYCLIC )
		{
			SetUse ( &CMonsterMaker::CyclicUse );// drop one monster each time we fire
		}
		else
		{
			SetUse ( &CMonsterMaker::ToggleUse );// so can be turned on/off
		}

		if ( FBitSet ( pev->spawnflags, SF_MONSTERMAKER_START_ON ) )
		{// start making monsters as soon as monstermaker spawns
			m_fActive = true;
			SetThink ( &CMonsterMaker::MakerThink );
		}
		else
		{// wait to be activated.
			m_fActive = false;
			SetThink ( &CMonsterMaker::SUB_DoNothing );
		}
	}
	else
	{// no targetname, just start.
			pev->nextthink = gpGlobals->time + m_flDelay;
			m_fActive = true;
			SetThink ( &CMonsterMaker::MakerThink );
	}

	if ( m_cNumMonsters == 1 )
	{
		m_fFadeChildren = false;
	}
	else
	{
		m_fFadeChildren = true;
	}

	m_flGround = 0;
}
Example #22
0
void CTriggerSubModel :: Spawn ( void )
{
	pev->solid			= SOLID_NOT;
	pev->movetype		= MOVETYPE_NONE;	
	pev->takedamage		= DAMAGE_NO;

	SetUse ( ChangeSub );
}
Example #23
0
void CRotButton::Spawn( void )
{
	char *pszSound;
	//----------------------------------------------------
	//determine sounds for buttons
	//a sound of 0 should not make a sound
	//----------------------------------------------------
	pszSound = ButtonSound( m_sounds );
	PRECACHE_SOUND(pszSound);
	pev->noise = ALLOC_STRING(pszSound);

	// set the axis of rotation
	CBaseToggle::AxisDir( pev );

	// check for clockwise rotation
	if ( FBitSet (pev->spawnflags, SF_DOOR_ROTATE_BACKWARDS) )
		pev->movedir = pev->movedir * -1;

	pev->movetype	= MOVETYPE_PUSH;
	
	if ( pev->spawnflags & SF_ROTBUTTON_NOTSOLID )
		pev->solid		= SOLID_NOT;
	else
		pev->solid		= SOLID_BSP;

	SET_MODEL(ENT(pev), STRING(pev->model));
	
	if (pev->speed == 0)
		pev->speed = 40;

	if (m_flWait == 0)
		m_flWait = 1;

	if (pev->health > 0)
	{
		pev->takedamage = DAMAGE_YES;
	}

	m_toggle_state = TS_AT_BOTTOM;
	m_vecAngle1	= pev->angles;
	m_vecAngle2	= pev->angles + pev->movedir * m_flMoveDistance;
	ASSERTSZ(m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal");

	m_fStayPushed = (m_flWait == -1 ? TRUE : FALSE);
	m_fRotating = TRUE;

	// if the button is flagged for USE button activation only, take away it's touch function and add a use function
	if ( !FBitSet ( pev->spawnflags, SF_BUTTON_TOUCH_ONLY ) )
	{
		SetTouch ( NULL );
		SetUse	 ( &CBaseButton::ButtonUse );
	}
	else // touchable button
		SetTouch( &CBaseButton::ButtonTouch );

	//SetTouch( ButtonTouch );
}
Example #24
0
// Drop bombs from above
void CFuncMortarField :: Spawn( void )
{
	pev->solid = SOLID_NOT;
	SET_MODEL(ENT(pev), STRING(pev->model));    // set size and link into world
	pev->movetype = MOVETYPE_NONE;
	SetBits( pev->effects, EF_NODRAW );
	SetUse( &CFuncMortarField::FieldUse );
	Precache();
}
//-----------------------------------------------------------------------------
// Purpose: Place NPC somewhere on the perimeter of my radius.
//-----------------------------------------------------------------------------
void CTemplateNPCMaker::MakeNPCInRadius( void )
{
	if ( !CanMakeNPC(true))
		return;

	CAI_BaseNPC	*pent = NULL;
	CBaseEntity *pEntity = NULL;
	MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
	if ( pEntity != NULL )
	{
		pent = (CAI_BaseNPC *)pEntity;
	}

	if ( !pent )
	{
		Warning("NULL Ent in NPCMaker!\n" );
		return;
	}
	
	if ( !PlaceNPCInRadius( pent ) )
	{
		// Failed to place the NPC. Abort
		UTIL_RemoveImmediate( pent );
		return;
	}

	m_OnSpawnNPC.Set( pEntity, pEntity, this );

	pent->AddSpawnFlags( SF_NPC_FALL_TO_GROUND );

	pent->RemoveSpawnFlags( SF_NPC_TEMPLATE );
	ChildPreSpawn( pent );

	DispatchSpawn( pent );

	pent->SetOwnerEntity( this );
	DispatchActivate( pent );

	ChildPostSpawn( pent );

	m_nLiveChildren++;// count this NPC

	if (!(m_spawnflags & SF_NPCMAKER_INF_CHILD))
	{
		m_nMaxNumNPCs--;

		if ( IsDepleted() )
		{
			m_OnAllSpawned.FireOutput( this, this );

			// Disable this forever.  Don't kill it because it still gets death notices
			SetThink( NULL );
			SetUse( NULL );
		}
	}
}
Example #26
0
void CTriggerCounter::Spawn( void )
{
	// By making the flWait be -1, this counter-trigger will disappear after it's activated
	// (but of course it needs cTriggersLeft "uses" before that happens).
	m_flWait = -1;

	if( m_cTriggersLeft == 0 )
		m_cTriggersLeft = 2;
	SetUse( &CTriggerCounter::CounterUse );
}
void CAI_PlayerAlly::Event_Killed( const CTakeDamageInfo &info )
{
	AlertFriends( info.GetAttacker() );

	SetTarget( NULL );
	// Don't finish that sentence
	StopTalking();
	SetUse( NULL );
	BaseClass::Event_Killed( info );
}
Example #28
0
/* <f694a> ../cstrike/dlls/mortar.cpp:102 */
void CFuncMortarField::__MAKE_VHOOK(Spawn)(void)
{
	pev->solid = SOLID_NOT;

	// set size and link into world
	SET_MODEL(ENT(pev), STRING(pev->model));
	pev->movetype = MOVETYPE_NONE;
	pev->effects |= EF_NODRAW;

	SetUse(&CFuncMortarField::FieldUse);
	Precache();
}
Example #29
0
/* EXPORT->CreateSVector:  Shared version */
Vector CreateSVector(MemHeap *x, int size)
{
   SVector v;
   Ptr *p;
   int *i;
   
   p = (Ptr *)New(x,SVectorElemSize(size));
   v = (SVector) (p+2);
   i = (int *) v; *i = size;
   SetHook(v,NULL);
   SetUse(v,0);
   return v;
}
void CBreakable::Spawn( void )
{
    Precache( );    

	if ( FBitSet( pev->spawnflags, SF_BREAK_TRIGGER_ONLY ) )
		pev->takedamage	= DAMAGE_NO;
	else
		pev->takedamage	= DAMAGE_YES;
  
	if (m_iClass) //LRC - might these additions cause problems?
	{
		pev->flags |= FL_MONSTER; 
		pev->view_ofs = (pev->maxs + pev->mins) / 2;
	}

	if (m_iszWhenHit) //LRC - locus trigger
	{
		m_pHitProxy = GetClassPtr( (CPointEntity*)NULL );
	}

	pev->solid		= SOLID_BSP;
    pev->movetype	= MOVETYPE_PUSH;
    m_angle			= pev->angles.y;
	pev->angles.y	= 0;
	m_iInitialHealth = pev->health;
	m_iInitialRenderAmt = pev->renderamt;
	m_iInitialRenderMode = pev->rendermode;

	// HACK:  matGlass can receive decals, we need the client to know about this
	//  so use class to store the material flag
	if ( m_Material == matGlass )
	{
		pev->playerclass = 1;
	}

	SET_MODEL(ENT(pev), STRING(pev->model) );//set size and link into world.

	SetTouch(&CBreakable:: BreakTouch );
	SetUse(&CBreakable:: BreakUse );
	if ( FBitSet( pev->spawnflags, SF_BREAK_TRIGGER_ONLY ) )		// Only break on trigger
		SetTouch( NULL );

	// Flag unbreakable glass as "worldbrush" so it will block ALL tracelines
	if ( !IsBreakable() && pev->rendermode != kRenderNormal )
		pev->flags |= FL_WORLDBRUSH;

	if (m_iStyle >= 32)
		LIGHT_STYLE(m_iStyle, "z");
	else if (m_iStyle <= -32)
		LIGHT_STYLE(-m_iStyle, "a");
}