void CBaseGrenadeContact::Spawn( void ) { // point sized, solid, bouncing SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); SetSolid( SOLID_BBOX ); SetCollisionGroup( COLLISION_GROUP_PROJECTILE ); SetModel( "models/weapons/w_grenade.mdl" ); // BUG: wrong model UTIL_SetSize(this, vec3_origin, vec3_origin); // contact grenades arc lower SetGravity( UTIL_ScaleForGravity( 400 ) ); // use a lower gravity for grenades to make them easier to see QAngle angles; VectorAngles(GetAbsVelocity(), angles); SetLocalAngles( angles ); // make NPCs afaid of it while in the air SetThink( &CBaseGrenadeContact::DangerSoundThink ); SetNextThink( gpGlobals->curtime ); // Tumble in air QAngle vecAngVelocity( random->RandomFloat ( -100, -500 ), 0, 0 ); SetLocalAngularVelocity( vecAngVelocity ); // Explode on contact SetTouch( &CBaseGrenadeContact::ExplodeTouch ); m_flDamage = 100; // BOXBOX was sk_plr_dmg_grenade.GetFloat(); // Allow player to blow this puppy up in the air m_takedamage = DAMAGE_YES; m_iszBounceSound = NULL_STRING; }
void CASW_Boomer_Blob::Spawn( void ) { //d:\dev\main\game\infested\models\swarm\mortarbugprojectile\mortarbugprojectile.mdl Precache(); SetModel( ASW_BOOMER_BLOB_MODEL ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); m_flDamage = 80; m_DmgRadius = 165.0f; // NOTE: this gets overriden m_takedamage = DAMAGE_NO; m_iHealth = 1; m_bModelOpening = false; SetSize( -Vector(4,4,4), Vector(4,4,4) ); SetSolid( SOLID_BBOX ); SetGravity( asw_boomer_blob_gravity.GetFloat() ); SetFriction( asw_boomer_blob_friction.GetFloat() ); SetElasticity( asw_vindicator_grenade_elasticity.GetFloat() ); SetCollisionGroup( ASW_COLLISION_GROUP_PASSABLE ); SetTouch( &CASW_Boomer_Blob::Touch ); //CreateEffects(); m_hFirer = NULL; // Tumble in air QAngle vecAngVelocity( random->RandomFloat ( -100, -500 ), 0, 0 ); SetLocalAngularVelocity( vecAngVelocity ); m_fEarliestAOEDetonationTime = GetEarliestAOEDetonationTime(); m_fEarliestTouchDetonationTime = GetEarliestTouchDetonationTime(); m_iClusters = 0; m_bMaster = true; ResetSequence( LookupSequence( "MortarBugProjectile_Closed" ) ); //EmitSound( "ASWGrenade.Alarm" ); SetFuseLength( asw_boomer_blob_fuse.GetFloat() + RandomFloat( -0.25, 0.66f ) ); if ( m_fDetonateTime <= gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ) { SetThink( &CASW_Boomer_Blob::Detonate ); SetNextThink( m_fDetonateTime ); } else { SetThink( &CASW_Boomer_Blob::CheckNearbyTargets ); SetNextThink( gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ); } }
void CGib::SpawnStickyGibs( CBaseEntity *pVictim, Vector vecOrigin, int cGibs ) { int i; //City17: Germany Violence Fix. /*if ( g_Language.GetInt() == LANGUAGE_GERMAN ) { // no sticky gibs in germany right now! return; }*/ for ( i = 0 ; i < cGibs ; i++ ) { CGib *pGib = (CGib *)CreateEntityByName( "gib" ); pGib->Spawn( "models/stickygib.mdl" ); pGib->m_nBody = random->RandomInt(0,2); if ( pVictim ) { pGib->SetLocalOrigin( Vector( vecOrigin.x + random->RandomFloat( -3, 3 ), vecOrigin.y + random->RandomFloat( -3, 3 ), vecOrigin.z + random->RandomFloat( -3, 3 ) ) ); // make the gib fly away from the attack vector Vector vecNewVelocity = g_vecAttackDir * -1; // mix in some noise vecNewVelocity.x += random->RandomFloat ( -0.15, 0.15 ); vecNewVelocity.y += random->RandomFloat ( -0.15, 0.15 ); vecNewVelocity.z += random->RandomFloat ( -0.15, 0.15 ); vecNewVelocity *= 900; QAngle vecAngVelocity( random->RandomFloat ( 250, 400 ), random->RandomFloat ( 250, 400 ), 0 ); pGib->SetLocalAngularVelocity( vecAngVelocity ); // copy owner's blood color pGib->SetBloodColor( pVictim->BloodColor() ); pGib->AdjustVelocityBasedOnHealth( pVictim->m_iHealth, vecNewVelocity ); pGib->SetAbsVelocity( vecNewVelocity ); pGib->SetMoveType( MOVETYPE_FLYGRAVITY ); pGib->RemoveSolidFlags( FSOLID_NOT_SOLID ); pGib->SetCollisionBounds( vec3_origin, vec3_origin ); pGib->SetTouch ( &CGib::StickyGibTouch ); pGib->SetThink (NULL); } pGib->LimitVelocity(); } }
void CASW_Bait::Spawn( void ) { Precache( ); SetModel( BAIT_MODEL ); UTIL_SetSize( this, Vector( -2, -2, -2 ), Vector( 2, 2, 2 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); m_takedamage = DAMAGE_NO; SetFriction( 0.6f ); m_flTimeBurnOut = gpGlobals->curtime + 30; AddEffects( EF_NOSHADOW|EF_NORECEIVESHADOW ); AddFlag( FL_OBJECT ); SetCollisionGroup( ASW_COLLISION_GROUP_IGNORE_NPCS ); //CreateVPhysics(); // Tumble in air QAngle vecAngVelocity( 0, random->RandomFloat ( -100, -500 ), 0 ); SetLocalAngularVelocity( vecAngVelocity ); SetTouch( &CASW_Bait::BaitTouch ); SetThink( &CASW_Bait::BaitThink ); // join the flares team so that aliens will hate us ChangeFaction( FACTION_BAIT ); if ( ASW_BAIT_LIFETIME > 0 ) { m_flTimeBurnOut = gpGlobals->curtime + ASW_BAIT_LIFETIME; } else { m_flTimeBurnOut = -1.0f; } SetNextThink( gpGlobals->curtime + 0.1f ); g_AI_SensedObjectsManager.AddEntity( this ); }