//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CResourceChunk::Spawn( )
{
	// Init model
	if ( IsProcessed() )
	{
		SetModelName( AllocPooledString( sProcessedResourceChunkModel ) );
	}
	else
	{
		SetModelName( AllocPooledString( sResourceChunkModel ) );
	}

	BaseClass::Spawn();

	UTIL_SetSize( this, Vector(-4,-4,-4), Vector(4,4,4) );
	SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_TRIGGER );
	CollisionProp()->UseTriggerBounds( true, 24 );
	SetCollisionGroup( TFCOLLISION_GROUP_RESOURCE_CHUNK );
	SetGravity( 1.0 );
	SetFriction( 1 );
	SetTouch( ChunkTouch );
	SetThink( ChunkRemove );
	SetNextThink( gpGlobals->curtime + random->RandomFloat( 50.0, 80.0 ) ); // Remove myself the
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPointCommentaryNode::Spawn( void )
{
	// No model specified?
	char *szModel = (char *)STRING( GetModelName() );
	if (!szModel || !*szModel)
	{
		szModel = "models/extras/info_speech.mdl";
		SetModelName( AllocPooledString(szModel) );
	}

	Precache();
	SetModel( szModel );
	UTIL_SetSize( this, -Vector(16,16,16), Vector(16,16,16) );
	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_CUSTOMRAYTEST | FSOLID_CUSTOMBOXTEST );
	AddEffects( EF_NOSHADOW );

	// Setup for animation
	ResetSequence( LookupSequence("idle") );
	SetThink( &CPointCommentaryNode::SpinThink );
	SetNextThink( gpGlobals->curtime + 0.1f ); 

	m_iNodeNumber = 0;
	m_iNodeNumberMax = 0;

	SetDisabled( m_bDisabled );
}
Esempio n. 3
0
/**
 * Parse KeyValue pairs
 */
bool CFishPool::KeyValue( const char *szKeyName, const char *szValue )
{
	if (FStrEq( szKeyName, "fish_count" ))
	{
		m_fishCount = atoi(szValue);
		return true;
	}
	else if (FStrEq( szKeyName, "max_range" ))
	{
		m_maxRange = atof(szValue);
		if (m_maxRange <= 1.0f)
		{
			m_maxRange = 1.0f;
		}
		else if (m_maxRange > 255.0f)
		{
			// stay within 8 bits range
			m_maxRange = 255.0f;
		}

		return true;
	}
	else if (FStrEq( szKeyName, "model" ))
	{
		PrecacheModel( szValue );
		SetModelName( AllocPooledString( szValue ) );
	}

	return BaseClass::KeyValue( szKeyName, szValue );
}
void CNPC_Portal_FloorTurret::Precache( void )
{
	SetModelName( MAKE_STRING( FLOOR_TURRET_PORTAL_MODEL ) );

	BaseClass::Precache();

	ADD_CUSTOM_ACTIVITY( CNPC_FloorTurret, ACT_FLOOR_TURRET_FIRE2 );

	m_sLaserHaloSprite = PrecacheModel( "sprites/redlaserglow.vmt" );
	PrecacheModel("effects/redlaser1.vmt");

	for ( int iTalkScript = 0; iTalkScript < PORTAL_TURRET_STATE_TOTAL; ++iTalkScript )
	{
		if ( iTalkScript < TURRET_STATE_TOTAL )
		{
			if ( g_TalkNames[ iTalkScript ] )
				PrecacheScriptSound( g_TalkNames[ iTalkScript ] );
			else
				iTalkScript = TURRET_STATE_TOTAL - 1;	// We hit the last script item, so jump to the portal only states
		}
		else
		{
			PrecacheScriptSound( g_PortalTalkNames[ iTalkScript - TURRET_STATE_TOTAL ] );
		}
	}
}
Esempio n. 5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::Spawn( void )
{	
	SetModelName( AllocPooledString("models/magnusson_device.mdl") );
	BaseClass::Spawn();
	
	// Setup for being shot by the player
	m_takedamage = DAMAGE_EVENTS_ONLY;

	// Ignore touches until launched.
	SetTouch ( NULL );

	AddFlag( FL_AIMTARGET|FL_OBJECT );

	m_hParticleEffect = CreateEntityByName( "info_particle_system" );
	if ( m_hParticleEffect )
	{
		m_hParticleEffect->KeyValue( "start_active", "1" );
		m_hParticleEffect->KeyValue( "effect_name", "striderbuster_smoke" );
		DispatchSpawn( m_hParticleEffect );
		if ( gpGlobals->curtime > 0.2f )
		{
			m_hParticleEffect->Activate();
		}
		m_hParticleEffect->SetAbsOrigin( GetAbsOrigin() );
		m_hParticleEffect->SetParent( this );
	}

	SetHealth( striderbuster_health.GetFloat() );
	
	SetNextThink(gpGlobals->curtime + 0.01f);
}
Esempio n. 6
0
void CE_CBeam::BeamInit( const char *pSpriteName, float width )
{
	SetColor( 255, 255, 255 );
	SetBrightness( 255 );
	SetNoise( 0 );
	SetFrame( 0 );
	SetScrollRate( 0 );
	SetModelName( MAKE_STRING( pSpriteName ) );
	SetRenderMode( kRenderTransTexture );
	SetTexture( engine->PrecacheModel( pSpriteName ) );
	SetWidth( width );
	SetEndWidth( width );
	SetFadeLength( 0 );			// No fade

	for (int i=0;i<MAX_BEAM_ENTS;i++)
	{
		Set_m_hAttachEntity(i,NULL);
		Set_m_nAttachIndex(i, 0);
	}

	m_nHaloIndex	= 0;
	m_fHaloScale	= BEAM_DEFAULT_HALO_SCALE;
	m_nBeamType		= 0;
	m_nBeamFlags    = 0;
}
Esempio n. 7
0
//-----------------------------------------------------------------------------
// Spawn
//-----------------------------------------------------------------------------
void CNPC_Kleiner::Spawn()
{
	// Allow custom model usage (mostly for monitors)
	char *szModel = (char *)STRING( GetModelName() );
	if (!szModel || !*szModel)
	{
		szModel = "models/kleiner.mdl";
		SetModelName( AllocPooledString(szModel) );
	}

	Precache();
	SetModel( szModel );

	BaseClass::Spawn();

	SetHullType(HULL_HUMAN);
	SetHullSizeNormal();

	SetSolid( SOLID_BBOX );
	AddSolidFlags( FSOLID_NOT_STANDABLE );
	SetMoveType( MOVETYPE_STEP );
	SetBloodColor( BLOOD_COLOR_RED );
	m_iHealth			= 8;
	m_flFieldOfView		= 0.5;// indicates the width of this NPC's forward view cone ( as a dotproduct result )
	m_NPCState			= NPC_STATE_NONE;
	
	CapabilitiesAdd( bits_CAP_MOVE_GROUND | bits_CAP_OPEN_DOORS | bits_CAP_ANIMATEDFACE | bits_CAP_TURN_HEAD );
	CapabilitiesAdd( bits_CAP_FRIENDLY_DMG_IMMUNE );

	AddEFlags( EFL_NO_DISSOLVE | EFL_NO_MEGAPHYSCANNON_RAGDOLL | EFL_NO_PHYSCANNON_INTERACTION );

	NPCInit();
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
C_CHostage::C_CHostage()
{
	g_Hostages.AddToTail( this );

	m_flDeadOrRescuedTime = 0.0;
	m_flLastBodyYaw = 0;
	m_createdLowViolenceRagdoll = false;
	
	// TODO: Get IK working on the steep slopes CS has, then enable it on characters.
	m_EntClientFlags |= ENTCLIENTFLAG_DONTUSEIK;

	// set the model so the PlayerAnimState uses the Hostage activities/sequences
	SetModelName( "models/Characters/Hostage_01.mdl" );

	m_PlayerAnimState = CreateHostageAnimState( this, this, LEGANIM_8WAY, false );
	
	m_leader = NULL;
	m_blinkTimer.Invalidate();
	m_seq = -1;

	m_flCurrentHeadPitch = 0;
	m_flCurrentHeadYaw = 0;

	m_eyeAttachment = -1;
	m_chestAttachment = -1;
	m_headYawPoseParam = -1;
	m_headPitchPoseParam = -1;
	m_lookAt = Vector( 0, 0, 0 );
	m_isInit = false;
	m_lookAroundTimer.Invalidate();
}
CASW_BuffGrenade_Projectile::CASW_BuffGrenade_Projectile()
{
    SetModelName( MAKE_STRING( BUFFGREN_MODEL ) );
    m_pSkill = NULL;
    m_iSkillPoints = 1;
    m_nSkin = 1;
}
Esempio n. 10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CEnvLaser::KeyValue( const char *szKeyName, const char *szValue )
{
	if (FStrEq(szKeyName, "width"))
	{
		SetWidth( atof(szValue) );
	}
	else if (FStrEq(szKeyName, "NoiseAmplitude"))
	{
		SetNoise( atoi(szValue) );
	}
	else if (FStrEq(szKeyName, "TextureScroll"))
	{
		SetScrollRate( atoi(szValue) );
	}
	else if (FStrEq(szKeyName, "texture"))
	{
		SetModelName( AllocPooledString(szValue) );
	}
	else
	{
		BaseClass::KeyValue( szKeyName, szValue );
	}

	return true;
}
void C_PortalGhostRenderable::PerFrameUpdate( void )
{
	if( m_pGhostedRenderable )
	{
		SetModelName( m_pGhostedRenderable->GetModelName() );
		SetModelIndex( m_pGhostedRenderable->GetModelIndex() );
		SetEffects( m_pGhostedRenderable->GetEffects() | EF_NOINTERP );		
		m_flAnimTime = m_pGhostedRenderable->m_flAnimTime;		

		if( m_bSourceIsBaseAnimating )
		{
			C_BaseAnimating *pSource = (C_BaseAnimating *)m_pGhostedRenderable;
			SetCycle( pSource->GetCycle() );
			SetSequence( pSource->GetSequence() );
			m_nBody = pSource->m_nBody;
			m_nSkin = pSource->m_nSkin;
		}
	}


	// Set position and angles relative to the object it's ghosting
	Vector ptNewOrigin = m_matGhostTransform * m_pGhostedRenderable->GetAbsOrigin();		
	QAngle qNewAngles = TransformAnglesToWorldSpace( m_pGhostedRenderable->GetAbsAngles(), m_matGhostTransform.As3x4() );

	SetAbsOrigin( ptNewOrigin );
	SetAbsAngles( qNewAngles );

	AddEffects( EF_NOINTERP );

	RemoveFromInterpolationList();

	g_pClientLeafSystem->RenderableChanged( RenderHandle() );
}
Esempio n. 12
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponStriderBuster::Precache( void )
{
	PrecacheScriptSound( "Weapon_StriderBuster.StickToEntity" );
	PrecacheScriptSound( "Weapon_StriderBuster.Detonate" );
	PrecacheScriptSound( "Weapon_StriderBuster.Dud_Detonate" );
	PrecacheScriptSound( "Weapon_StriderBuster.Ping" );

	PrecacheModel("sprites/orangeflare1.vmt");

	UTIL_PrecacheOther( "env_citadel_energy_core" );
	UTIL_PrecacheOther( "sparktrail" );

	m_nRingTexture = PrecacheModel( "sprites/lgtning.vmt" );

	PrecacheParticleSystem( "striderbuster_attach" );
	PrecacheParticleSystem( "striderbuster_attached_pulse" );
	PrecacheParticleSystem( "striderbuster_explode_core" );
	PrecacheParticleSystem( "striderbuster_explode_dummy_core" );
	PrecacheParticleSystem( "striderbuster_break_flechette" );
	PrecacheParticleSystem( "striderbuster_trail" );
	PrecacheParticleSystem( "striderbuster_shotdown_trail" );
	PrecacheParticleSystem( "striderbuster_break" );
	PrecacheParticleSystem( "striderbuster_flechette_attached" );

	SetModelName( AllocPooledString("models/magnusson_device.mdl") );
	BaseClass::Precache();
}
Esempio n. 13
0
//-----------------------------------------------------------------------------
// Purpose:
// Input  :
// Output :
//-----------------------------------------------------------------------------
void CNPC_CombineS::Precache()
{
	const char *pModelName = STRING( GetModelName() );

	if( !Q_stricmp( pModelName, "models/combine_super_soldier.mdl" ) )
	{
		m_fIsElite = true;
	}
	else
	{
		m_fIsElite = false;
	}

	if( !GetModelName() )
	{
		SetModelName( MAKE_STRING( "models/combine_soldier.mdl" ) );
	}

	PrecacheModel( STRING( GetModelName() ) );

	UTIL_PrecacheOther( "item_healthvial" );
	UTIL_PrecacheOther( "weapon_frag" );
	UTIL_PrecacheOther( "item_ammo_ar2_altfire" );

	BaseClass::Precache();
}
Esempio n. 14
0
void CTriggerVolume::Spawn( void )
{
	SetSolidType( SOLID_NOT );
	SetMoveType( MOVETYPE_NONE );
	SetModel( GetModelName() );    // set size and link into world
	SetModelName( iStringNull );
	SetModelIndex( 0 );
}
CASW_HealGrenade_Projectile::CASW_HealGrenade_Projectile()
{
	SetModelName( MAKE_STRING( HEALGREN_MODEL ) );

	m_flHealPerSecond = 3.0f;
	m_flHealAmountLeft = 0.0f;
	m_nSkin = 2;
}
Esempio n. 16
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void Dota_Resupply::Precache( void )
{
	SetModelName( AllocPooledString( "models/items/ammocrate_ar2.mdl" ) );

	PrecacheModel( STRING( GetModelName() ) );

	PrecacheScriptSound( "AmmoCrate.Open" );
	PrecacheScriptSound( "AmmoCrate.Close" );
}
Esempio n. 17
0
void CPropThumper::Spawn( void )
{
	char *szModel = (char *)STRING( GetModelName() );
	if (!szModel || !*szModel)
	{
		szModel = THUMPER_MODEL_NAME;
		SetModelName( AllocPooledString(szModel) );
	}

	Precache();
	SetModel( szModel );

	SetSolid( SOLID_VPHYSICS );
	SetMoveType( MOVETYPE_NONE );
	VPhysicsInitStatic();

	BaseClass::Spawn();

	m_bEnabled = true;

	SetThink( &CPropThumper::Think );
	SetNextThink( gpGlobals->curtime + 1.0f );

	int iSequence = SelectHeaviestSequence ( ACT_IDLE );

	if ( iSequence != ACT_INVALID )
	{
		 SetSequence( iSequence );
		 ResetSequenceInfo();

		 //Do this so we get the nice ramp-up effect.
		 m_flPlaybackRate = random->RandomFloat( 0.0f, 1.0f);
	}

	m_iHammerAttachment = LookupAttachment( "hammer" );
	
	CAntlionRepellant *pRepellant = (CAntlionRepellant*)CreateEntityByName( "point_antlion_repellant" );

	if ( pRepellant )
	{
		pRepellant->Spawn();
		pRepellant->SetAbsOrigin( GetAbsOrigin() );
		pRepellant->SetRadius( THUMPER_RADIUS );

		m_hRepellantEnt = pRepellant;
	}

	if ( m_iDustScale == 0 )
		 m_iDustScale = THUMPER_MIN_SCALE;

#if HL2_EPISODIC
	if ( m_iEffectRadius == 0 )
		m_iEffectRadius = 1000;
#endif

}
Esempio n. 18
0
void CReplayBall::Spawn( void )
{
	SetClassname("replay_ball");
	Precache();
	SetModelName(MAKE_STRING(BALL_MODEL));
	CreateVPhysics();
	//SetSolid(SOLID_NONE);
	SetSimulatedEveryTick(true);
	SetAnimatedEveryTick(true);
}
void CDODSmokeGrenade::Think_Remove()
{
	if ( m_hSmokeEffect.Get() )
		UTIL_Remove( m_hSmokeEffect );

	SetModelName( NULL_STRING );//invisible
	SetSolid( SOLID_NONE );
	SetMoveType( MOVETYPE_NONE );

	UTIL_Remove( this );
}
bool C_PhysPropClientside::KeyValue( const char *szKeyName, const char *szValue )
{
	if (FStrEq(szKeyName, "physdamagescale"))
	{
		m_impactEnergyScale = atof(szValue);
	}
	else if ( FStrEq(szKeyName, "health") )
	{
		m_iHealth = Q_atoi(szValue);
	}
	else if (FStrEq(szKeyName, "spawnflags"))
	{
		m_spawnflags = Q_atoi(szValue);
	}
	else if (FStrEq(szKeyName, "model"))
	{
		SetModelName( AllocPooledString( szValue ) );
	}
	else if (FStrEq(szKeyName, "fademaxdist"))
	{
		m_fadeMaxDist = Q_atof(szValue);
	}
	else if (FStrEq(szKeyName, "fademindist"))
	{
		m_fadeMinDist = Q_atof(szValue);
	}
	else if (FStrEq(szKeyName, "fadescale"))
	{
		m_flFadeScale = Q_atof(szValue);
	}
	else if (FStrEq(szKeyName, "inertiaScale"))
	{
		m_inertiaScale = Q_atof(szValue);
	}
	else if (FStrEq(szKeyName, "skin"))
	{
		m_nSkin  = Q_atoi(szValue);
	}
	else if (FStrEq(szKeyName, "physicsmode"))
	{
		m_iPhysicsMode = Q_atoi(szValue);
	}

	else
	{
		if ( !BaseClass::KeyValue( szKeyName, szValue ) )
		{
			// key hasn't been handled
			return false;
		}
	}

	return true;
}
Esempio n. 21
0
void CPropVehicleManhack::Precache( void )
{
	SetModelName( AllocPooledString("models/vehicles/vehicle_manhackcontroller.mdl") );

	BaseClass::Precache();

//	PrecacheModel( GetModelName() );
	PrecacheScriptSound("NPC_Turret.Retire");

	m_ServerVehicle.Initialize( "scripts/vehicles/manhack.txt" );
}
Esempio n. 22
0
//-----------------------------------------------------------------------------
// Purpose: Precache 
//-----------------------------------------------------------------------------
void CTFBaseDMPowerup::Precache( void )
{
	UTIL_ValidateSoundName( m_strPickupSound, GetDefaultPickupSound() );
	if ( GetModelName() == NULL_STRING )
		SetModelName( AllocPooledString( GetDefaultPowerupModel() ) );

	PrecacheModel( STRING( GetModelName() ) );
	PrecacheScriptSound( STRING( m_strPickupSound ) );

	BaseClass::Precache();
}
Esempio n. 23
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPhysImpact::Spawn( void )
{
	SetMoveType( MOVETYPE_NONE );
	SetSolid( SOLID_NONE );
	SetModelName( NULL_STRING );

	//If not targetted, and no distance is set, give it a default value
	if ( m_distance == 0 )
	{
		m_distance = DEFAULT_EXPLODE_DISTANCE;
	}
}
Esempio n. 24
0
void CWorld::Spawn( void )
{
	SetLocalOrigin( vec3_origin );
	SetLocalAngles( vec3_angle );
	// NOTE:  SHOULD NEVER BE ANYTHING OTHER THAN 1!!!
	SetModelIndex( 1 );
	// world model
	SetModelName( MAKE_STRING( modelinfo->GetModelName( GetModel() ) ) );
	AddFlag( FL_WORLDBRUSH );

	g_EventQueue.Init();
	Precache( );
}
void CEnvExplosion::Spawn( void )
{ 
	Precache();

	BaseClass::Spawn();

	SetModelName( NULL_STRING );//invisible
	SetSolid( SOLID_NONE );

	AddEffects( EF_NODRAW );
	SetMoveType( MOVETYPE_NONE );
	m_iCustomDamageType = -1;
}
Esempio n. 26
0
void CASW_Item_Crate::Spawn()
{
	DisableAutoFade();
	SetModelName( AllocPooledString( ASW_ITEM_CRATE_MODEL ) );
	Precache();
	SetModel( ASW_ITEM_CRATE_MODEL );
	AddSpawnFlags(SF_PHYSPROP_AIMTARGET);
	BaseClass::Spawn();
	m_nSkin = 2;
	SetHealth(30);
	SetMaxHealth(30);
	m_takedamage = DAMAGE_YES;
}
bool C_ASW_Snow_Volume::KeyValue( const char *szKeyName, const char *szValue ) 
{
	if ( FStrEq( szKeyName, "model" ) )
	{
		SetModelName( AllocPooledString( szValue ) );
		return true;
	}
	if ( FStrEq( szKeyName, "snowtype" ) )
	{		
		m_iSnowType = atoi(szValue);		
		return true;
	}
	return BaseClass::KeyValue(szKeyName, szValue);
}
//-----------------------------------------------------------------------------
// Purpose:
// Input  :
// Output :
//-----------------------------------------------------------------------------
void CNPC_WpnScanner::Precache()
{
	if( !GetModelName() )
	{
		SetModelName( MAKE_STRING( "models/combine_scanner.mdl" ) );
	}

	PrecacheModel( STRING( GetModelName() ) );

	m_iszProjectileModel = MAKE_STRING( "models/crossbow_bolt.mdl" );
	PrecacheModel( STRING(m_iszProjectileModel) );

	BaseClass::Precache();
}
Esempio n. 29
0
void CASW_Barrel_Explosive::Spawn()
{
	DisableAutoFade();
	SetModelName( AllocPooledString( ASW_EXPLOSIVE_BARREL_MODEL_NAME ) );
	Precache();
	SetModel( ASW_EXPLOSIVE_BARREL_MODEL_NAME );

	AddSpawnFlags( SF_PHYSPROP_AIMTARGET );
	BaseClass::Spawn();

	InitHealth();

	VisibilityMonitor_AddEntity( this, asw_visrange_generic.GetFloat() * 0.9f, NULL, NULL );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFBaseRocket::Explode( trace_t *pTrace, CBaseEntity *pOther )
{
	// Save this entity as enemy, they will take 100% damage.
	m_hEnemy = pOther;

	// Invisible.
	SetModelName( NULL_STRING );
	AddSolidFlags( FSOLID_NOT_SOLID );
	m_takedamage = DAMAGE_NO;

	// Pull out a bit.
	if ( pTrace->fraction != 1.0 )
	{
		SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) );
	}

	// Play explosion sound and effect.
	Vector vecOrigin = GetAbsOrigin();
	CPVSFilter filter( vecOrigin );
	TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), pOther->entindex() );
	CSoundEnt::InsertSound ( SOUND_COMBAT, vecOrigin, 1024, 3.0 );

	// Damage.
	CBaseEntity *pAttacker = GetOwnerEntity();
	IScorer *pScorerInterface = dynamic_cast<IScorer*>( pAttacker );
	if ( pScorerInterface )
	{
		pAttacker = pScorerInterface->GetScorer();
	}

	CTakeDamageInfo info( this, pAttacker, vec3_origin, vecOrigin, GetDamage(), GetDamageType() );
	float flRadius = GetRadius();
	RadiusDamage( info, vecOrigin, flRadius, CLASS_NONE, NULL );

	// Debug!
	if ( tf_rocket_show_radius.GetBool() )
	{
		DrawRadius( flRadius );
	}

	// Don't decal players with scorch.
	if ( !pOther->IsPlayer() )
	{
		UTIL_DecalTrace( pTrace, "Scorch" );
	}

	// Remove the rocket.
	UTIL_Remove( this );
}