//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSprite::TurnOff( void ) { AddEffects( EF_NODRAW ); SetNextThink( TICK_NEVER_THINK ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamControlPoint::InputHideModel( inputdata_t &input ) { AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSprite::Spawn( void ) { SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); m_flFrame = 0; Precache(); SetModel( STRING( GetModelName() ) ); CollisionProp()->SetSurroundingBoundsType( USE_GAME_CODE ); m_flMaxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1; AddEffects( EF_NOSHADOW | EF_NORECEIVESHADOW ); #if !defined( CLIENT_DLL ) if ( m_flGlowProxySize > MAX_GLOW_PROXY_SIZE ) { // Clamp on Spawn to prevent per-frame spew DevWarning( "env_sprite at setpos %0.0f %0.0f %0.0f has invalid glow size %f - clamping to %f\n", GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z, m_flGlowProxySize.Get(), MAX_GLOW_PROXY_SIZE ); m_flGlowProxySize = MAX_GLOW_PROXY_SIZE; } if ( GetEntityName() != NULL_STRING && !(m_spawnflags & SF_SPRITE_STARTON) ) { TurnOff(); } else #endif { TurnOn(); } // Worldcraft only sets y rotation, copy to Z if ( GetLocalAngles().y != 0 && GetLocalAngles().z == 0 ) { QAngle angles = GetLocalAngles(); angles.z = angles.y; angles.y = 0; SetLocalAngles( angles ); } // Clamp our scale if necessary float scale = m_flSpriteScale; if ( scale < 0 || scale > MAX_SPRITE_SCALE ) { #if !defined( CLIENT_DLL ) DevMsg( "LEVEL DESIGN ERROR: Sprite %s with bad scale %f [0..%f]\n", GetDebugName(), m_flSpriteScale, MAX_SPRITE_SCALE ); #endif scale = clamp( m_flSpriteScale, 0, MAX_SPRITE_SCALE ); } //Set our state SetBrightness( GetRenderAlpha() ); SetScale( scale ); #if defined( CLIENT_DLL ) m_flStartScale = m_flDestScale = m_flSpriteScale; m_nStartBrightness = m_nDestBrightness = m_nBrightness; #endif }
//--------------------------------------------------------- //--------------------------------------------------------- void CAI_RadialLinkController::Spawn() { SetSolid( SOLID_NONE ); AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Creates the explosion effect //----------------------------------------------------------------------------- void CEnvHeadcrabCanister::Detonate( ) { // Send the impact output m_OnImpacted.FireOutput( this, this, 0 ); if ( !HasSpawnFlags( SF_NO_IMPACT_SOUND ) ) { StopSound( "HeadcrabCanister.IncomingSound" ); EmitSound( "HeadcrabCanister.Explosion" ); } // If we're supposed to be removed, do that now if ( HasSpawnFlags( SF_REMOVE_ON_IMPACT ) ) { SetAbsOrigin( m_vecImpactPosition ); SetModel( ENV_HEADCRABCANISTER_BROKEN_MODEL ); SetMoveType( MOVETYPE_NONE ); AddEffects( EF_NOINTERP ); m_bLanded = true; // Become invisible so our trail can finish up AddEffects( EF_NODRAW ); SetSolidFlags( FSOLID_NOT_SOLID ); SetThink( &CEnvHeadcrabCanister::SUB_Remove ); SetNextThink( gpGlobals->curtime + ENV_HEADCRABCANISTER_TRAIL_TIME ); return; } // Test for damaging things TestForCollisionsAgainstWorld( m_vecImpactPosition ); // Shake the screen unless flagged otherwise if ( !HasSpawnFlags( SF_NO_SHAKE ) ) { CPlayer *pPlayer = UTIL_PlayerByIndex( 1 ); // If the player is on foot, then do a more limited shake float shakeRadius = ( pPlayer && pPlayer->IsInAVehicle() ) ? sk_env_headcrabcanister_shake_radius_vehicle.GetFloat() : sk_env_headcrabcanister_shake_radius.GetFloat(); UTIL_ScreenShake( m_vecImpactPosition, sk_env_headcrabcanister_shake_amplitude.GetFloat(), 150.0, 1.0, shakeRadius, SHAKE_START ); } // Do explosion effects if ( !HasSpawnFlags( SF_NO_IMPACT_EFFECTS ) ) { // Normal explosion ExplosionCreate( m_vecImpactPosition, GetAbsAngles(), BaseEntity(), 50, 500, SF_ENVEXPLOSION_NODLIGHTS | SF_ENVEXPLOSION_NOSPARKS | SF_ENVEXPLOSION_NODAMAGE | SF_ENVEXPLOSION_NOSOUND, 1300.0f ); // Dust explosion //CE_TODO /*AR2Explosion *pExplosion = AR2Explosion::CreateAR2Explosion( m_vecImpactPosition ); if( pExplosion ) { pExplosion->SetLifetime(10); }*/ } }
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution. void CBaseGrenade::Explode( trace_t *pTrace, int bitsDamageType ) { #if !defined( CLIENT_DLL ) SetModelName( NULL_STRING );//invisible AddSolidFlags( FSOLID_NOT_SOLID ); m_takedamage = DAMAGE_NO; // Pull out of the wall a bit if ( pTrace->fraction != 1.0 ) { SetAbsOrigin( pTrace->endpos + (pTrace->plane.normal * 0.6) ); } Vector vecAbsOrigin = GetAbsOrigin(); int contents = UTIL_PointContents ( vecAbsOrigin, MASK_ALL ); if ( pTrace->fraction != 1.0 ) { Vector vecNormal = pTrace->plane.normal; surfacedata_t *pdata = physprops->GetSurfaceData( pTrace->surface.surfaceProps ); CPASFilter filter( vecAbsOrigin ); te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, m_DmgRadius * .03, 25, TE_EXPLFLAG_NONE, m_DmgRadius, m_flDamage, &vecNormal, (char) pdata->game.material ); } else { CPASFilter filter( vecAbsOrigin ); te->Explosion( filter, -1.0, // don't apply cl_interp delay &vecAbsOrigin, !( contents & MASK_WATER ) ? g_sModelIndexFireball : g_sModelIndexWExplosion, m_DmgRadius * .03, 25, TE_EXPLFLAG_NONE, m_DmgRadius, m_flDamage ); } #if !defined( CLIENT_DLL ) CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 ); #endif // Use the thrower's position as the reported position Vector vecReported = m_hThrower ? m_hThrower->GetAbsOrigin() : vec3_origin; EmitSound( "BaseGrenade.Explode" ); CTakeDamageInfo info( this, m_hThrower, GetBlastForce(), GetAbsOrigin(), m_flDamage, bitsDamageType, 0, &vecReported ); RadiusDamage( info, GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL ); UTIL_DecalTrace( pTrace, "Scorch" ); SetThink( &CBaseGrenade::SUB_Remove ); SetTouch( NULL ); SetSolid( SOLID_NONE ); AddEffects( EF_NODRAW ); SetAbsVelocity( vec3_origin ); #if HL2_EPISODIC // Because the grenade is zipped out of the world instantly, the EXPLOSION sound that it makes for // the AI is also immediately destroyed. For this reason, we now make the grenade entity inert and // throw it away in 1/10th of a second instead of right away. Removing the grenade instantly causes // intermittent bugs with env_microphones who are listening for explosions. They will 'randomly' not // hear explosion sounds when the grenade is removed and the SoundEnt thinks (and removes the sound) // before the env_microphone thinks and hears the sound. SetNextThink( gpGlobals->curtime + 0.1 ); #else SetNextThink( gpGlobals->curtime ); #endif//HL2_EPISODIC #if defined( HL2_DLL ) CBasePlayer *pPlayer = ToBasePlayer( m_hThrower.Get() ); if ( pPlayer ) { gamestats->Event_WeaponHit( pPlayer, true, "weapon_frag", info ); } #endif #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Combine_Cannon::Spawn( void ) { Precache(); /// HACK: SetModel( "models/combine_soldier.mdl" ); // Setup our ancillary beams but keep them hidden for now CreateLaser(); CreateAncillaryBeams(); m_iAmmoType = GetAmmoDef()->Index( "CombineHeavyCannon" ); SetHullType( HULL_HUMAN ); SetHullSizeNormal(); UTIL_SetSize( this, Vector( -16, -16 , 0 ), Vector( 16, 16, 64 ) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_NOT_STANDABLE ); SetMoveType( MOVETYPE_FLY ); m_bloodColor = DONT_BLEED; m_iHealth = 10; m_flFieldOfView = DOT_45DEGREE; m_NPCState = NPC_STATE_NONE; if( HasSpawnFlags( SF_STARTDISABLED ) ) { m_fEnabled = false; } else { m_fEnabled = true; } CapabilitiesClear(); CapabilitiesAdd( bits_CAP_INNATE_RANGE_ATTACK1 | bits_CAP_SIMPLE_RADIUS_DAMAGE ); m_HackedGunPos = Vector ( 0, 0, 0 ); AddSpawnFlags( SF_NPC_LONG_RANGE | SF_NPC_ALWAYSTHINK ); NPCInit(); // Limit our look distance SetDistLook( m_flSightDist ); AddEffects( EF_NODRAW ); AddSolidFlags( FSOLID_NOT_SOLID ); // Point the cursor straight ahead so that the sniper's // first sweep of the laser doesn't look weird. Vector vecForward; AngleVectors( GetLocalAngles(), &vecForward ); m_vecPaintCursor = GetBulletOrigin() + vecForward * 1024; // none! GetEnemies()->SetFreeKnowledgeDuration( 0.0f ); GetEnemies()->SetEnemyDiscardTime( 2.0f ); m_flTimeLastAttackedPlayer = 0.0f; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFWeaponBaseGrenadeProj::Explode( trace_t *pTrace, int bitsDamageType ) { SetModelName( NULL_STRING );//invisible AddSolidFlags( FSOLID_NOT_SOLID ); m_takedamage = DAMAGE_NO; // Pull out of the wall a bit if ( pTrace->fraction != 1.0 ) { SetAbsOrigin( pTrace->endpos + ( pTrace->plane.normal * 1.0f ) ); } CSoundEnt::InsertSound ( SOUND_COMBAT, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 ); // Explosion effect on client Vector vecOrigin = GetAbsOrigin(); CPVSFilter filter( vecOrigin ); if ( UseImpactNormal() ) { if ( pTrace->m_pEnt && pTrace->m_pEnt->IsPlayer() ) { TE_TFExplosion( filter, 0.0f, vecOrigin, GetImpactNormal(), GetWeaponID(), pTrace->m_pEnt->entindex() ); } else { TE_TFExplosion( filter, 0.0f, vecOrigin, GetImpactNormal(), GetWeaponID(), -1 ); } } else { if ( pTrace->m_pEnt && pTrace->m_pEnt->IsPlayer() ) { TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), pTrace->m_pEnt->entindex() ); } else { TE_TFExplosion( filter, 0.0f, vecOrigin, pTrace->plane.normal, GetWeaponID(), -1 ); } } // Use the thrower's position as the reported position Vector vecReported = GetThrower() ? GetThrower()->GetAbsOrigin() : vec3_origin; float flRadius = GetDamageRadius(); if ( tf_grenade_show_radius.GetBool() ) { DrawRadius( flRadius ); } CTFRadiusDamageInfo radiusInfo; radiusInfo.info.Set( this, GetThrower(), m_hLauncher, GetBlastForce(), GetAbsOrigin(), m_flDamage, bitsDamageType, 0, &vecReported ); radiusInfo.m_vecSrc = vecOrigin; radiusInfo.m_flRadius = flRadius; radiusInfo.m_flSelfDamageRadius = 146.0f; TFGameRules()->RadiusDamage( radiusInfo ); // Don't decal players with scorch. if ( pTrace->m_pEnt && !pTrace->m_pEnt->IsPlayer() ) { UTIL_DecalTrace( pTrace, "Scorch" ); } SetThink( &CBaseGrenade::SUB_Remove ); SetTouch( NULL ); AddEffects( EF_NODRAW ); SetAbsVelocity( vec3_origin ); SetNextThink( gpGlobals->curtime ); }
//Called from PhysicsSimulate() or ReceiveMessage() bool CDHLProjectile::OnTouch( trace_t &touchtr, bool bDecalOnly /*= false*/, ITraceFilter* pTraceFilter /*= NULL*/ ) { //Direction Vector vecDir = touchtr.endpos - touchtr.startpos; if ( vecDir == vec3_origin ) //Sometimes endpos==startpos so we need to get dir from velocity instead { #ifdef CLIENT_DLL vecDir = GetLocalVelocity(); #else vecDir = m_vecCurVelocity; #endif VectorNormalize( vecDir ); } CBaseEntity* ent = touchtr.m_pEnt; if ( !ent ) return false; if ( touchtr.DidHit() ) { //Never collide with self, shooter, or other projectiles if ( ent == this || dynamic_cast<CDHLProjectile*>(ent) || ent == (CBaseEntity*)m_pShooter ) //|| ( (m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE) && (ent == m_pFiringWeapon) ) ) //Combat knife - don't collide with weapon ent return false; //Hack: Sometimes hits are registered prematurely (usually to the torso area) with no hitbox. Pretend nothing happened unless one is found. if ( ent->IsPlayer() && touchtr.hitgroup == 0 ) return false; //Check friendly fire if ( CheckFriendlyFire( ent ) ) { if ( !bDecalOnly ) { ClearMultiDamage(); //Do damage CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), m_iDamage, DMG_BULLET ); if ( m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE ) { //CalculateMeleeDamageForce( &dmgInfo, vecDir, touchtr.endpos, 0.01f ); Vector vecForce = vecDir; VectorNormalize( vecForce ); //vecForce *= 10.0f; //Ripped from C_ClientRagdoll::ImpactTrace dmgInfo.SetDamageForce( vecForce ); #ifndef CLIENT_DLL if ( IsOnFire() ) { CBaseAnimating* pBAnim = dynamic_cast<CBaseAnimating*>(ent); if ( pBAnim ) pBAnim->Ignite( 10.0f, false ); } #endif } else CalculateBulletDamageForce( &dmgInfo, m_iAmmoType, vecDir, touchtr.endpos, 1.0f ); dmgInfo.SetDamagePosition( touchtr.endpos ); ent->DispatchTraceAttack( dmgInfo, vecDir, &touchtr ); ApplyMultiDamage(); } #ifdef CLIENT_DLL if ( ent->GetCollisionGroup() == COLLISION_GROUP_BREAKABLE_GLASS ) return false; //Decals and such if ( !( touchtr.surface.flags & SURF_SKY ) && !touchtr.allsolid ) { IPredictionSystem::SuppressEvents( false ); if ( (m_iType == DHL_PROJECTILE_TYPE_BULLET || m_iType == DHL_PROJECTILE_TYPE_PELLET) ) { UTIL_ImpactTrace( &touchtr, DMG_BULLET ); } if ( m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE ) PlayImpactSound( touchtr.m_pEnt, touchtr, touchtr.endpos, touchtr.surface.surfaceProps ); IPredictionSystem::SuppressEvents( !prediction->IsFirstTimePredicted() ); } #endif } if ( pTraceFilter && m_iType != DHL_PROJECTILE_TYPE_COMBATKNIFE ) { PenetrationData_t nPenetrationData = DHLShared::TestPenetration( touchtr, m_pShooter, pTraceFilter, m_iTimesPenetrated, m_flDistanceTravelled, m_iAmmoType ); if ( nPenetrationData.m_bShouldPenetrate ) { m_flDistanceTravelled += GetLocalOrigin().DistTo( nPenetrationData.m_vecNewBulletPos ); MoveProjectileToPosition( nPenetrationData.m_vecNewBulletPos ); m_iTimesPenetrated++; return true; //Keep going - but don't do anything else in this frame of PhysicsSimulate() } } //We're done unless what we hit was breakable glass if ( ent->GetCollisionGroup() != COLLISION_GROUP_BREAKABLE_GLASS ) { #ifdef CLIENT_DLL m_bCollided = true; AddEffects( EF_NODRAW ); if ( m_pTrail ) //NULL pointer here sometimes somehow... m_pTrail->AddEffects( EF_NODRAW ); #else EntityMessageBegin( this ); WRITE_BYTE( MSG_NOTIFY_REMOVAL ); MessageEnd(); if ( touchtr.DidHitWorld() && m_iType == DHL_PROJECTILE_TYPE_COMBATKNIFE && !( touchtr.surface.flags & SURF_SKY ) ) { CBaseCombatWeapon* pKnifeEnt = assert_cast<CBaseCombatWeapon*>(CreateEntityByName( "weapon_combatknife" )); if ( pKnifeEnt ) { pKnifeEnt->AddSpawnFlags( SF_NORESPAWN ); //Needed for weapon spawn & VPhysics setup to work correctly pKnifeEnt->SetAbsOrigin( touchtr.endpos ); QAngle angles = vec3_angle; Vector vecKnifeDir = touchtr.startpos - touchtr.endpos; VectorAngles( vecKnifeDir, angles ); angles[PITCH] -= 15.0f; //Correct for the .mdl being offset a bit pKnifeEnt->SetLocalAngles( angles ); DispatchSpawn( pKnifeEnt ); //Spawns vphys object and sets it up, essentially a copy of CWeaponHL2MPBase::FallInit() pKnifeEnt->VPhysicsDestroyObject(); //Using SOLID_VPHYSICS instead of SOLID_BBOX (as ordinary weapons do) helps resolve some of the client side collision oddities Assert( pKnifeEnt->VPhysicsInitNormal( SOLID_VPHYSICS, FSOLID_NOT_STANDABLE | FSOLID_TRIGGER, true ) ); pKnifeEnt->SetPickupTouch(); //Sets up automagic removal after time IPhysicsObject* pKnifePhys = pKnifeEnt->VPhysicsGetObject(); if ( pKnifePhys ) { //Knives are solid to bullets...the only way to make them non-solid to bullets is to do SetSolid( SOLID_NONE ) or AddSolidFlags( FSOLID_NOT_SOLID ) //which breaks the +use pickup even with FSOLID_TRIGGER set. Let's just call it a feature :) pKnifePhys->EnableMotion( false ); pKnifePhys->EnableCollisions( false ); } if ( IsOnFire() ) pKnifeEnt->Ignite( 10.0f, false ); } } //SetThink( &CDHLProjectile::SUB_Remove ); //SetNextThink( gpGlobals->curtime + 0.1 ); //SUB_Remove(); //SetMoveType( MOVETYPE_NONE ); m_flRemoveAt = gpGlobals->curtime + 0.1f; //Give the notification message a head start so that the client will have time to react #endif } } return true; }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::Spawn( void ) { if ( !m_iszSpriteName ) { SetThink( &CEnvBeam::SUB_Remove ); return; } BaseClass::Spawn(); m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude); // Check for tapering if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) ) { SetWidth( m_boltWidth ); SetEndWidth( 0 ); } else { SetWidth( m_boltWidth ); SetEndWidth( GetWidth() ); // Note: EndWidth is not scaled } // if a non-targetentity endpoint was specified, transform it into local relative space // so it can move along with the base if (!m_vEndPointWorld.IsZero()) { WorldToEntitySpace( m_vEndPointWorld, &m_vEndPointRelative ); } else { m_vEndPointRelative.Zero(); } if ( ServerSide() ) { SetThink( &CEnvBeam::UpdateThink ); SetNextThink( gpGlobals->curtime ); SetFireTime( gpGlobals->curtime ); if ( GetEntityName() != NULL_STRING ) { if ( !(m_spawnflags & SF_BEAM_STARTON) ) { AddEffects( EF_NODRAW ); m_active = 0; SetNextThink( TICK_NEVER_THINK ); } else { m_active = 1; } } } else { m_active = 0; if ( !GetEntityName() || FBitSet(m_spawnflags, SF_BEAM_STARTON) ) { SetThink( &CEnvBeam::StrikeThink ); SetNextThink( gpGlobals->curtime + 1.0f ); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CFuncLadder::Spawn() { BaseClass::Spawn(); // Entity is symbolid SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); SetCollisionGroup( COLLISION_GROUP_NONE ); //AddFlag( FL_WORLDBRUSH ); SetModelName( NULL_STRING ); // Make entity invisible AddEffects( EF_NODRAW ); // No model but should still network AddEFlags( EFL_FORCE_CHECK_TRANSMIT ); Vector playerMins = VEC_HULL_MIN; Vector playerMaxs = VEC_HULL_MAX; // This will swap them if they are inverted SetEndPoints( m_vecPlayerMountPositionTop, m_vecPlayerMountPositionBottom ); #if !defined( CLIENT_DLL ) trace_t bottomtrace, toptrace; UTIL_TraceHull( m_vecPlayerMountPositionBottom, m_vecPlayerMountPositionBottom, playerMins, playerMaxs, MASK_PLAYERSOLID_BRUSHONLY, NULL, COLLISION_GROUP_PLAYER_MOVEMENT, &bottomtrace ); UTIL_TraceHull( m_vecPlayerMountPositionTop, m_vecPlayerMountPositionTop, playerMins, playerMaxs, MASK_PLAYERSOLID_BRUSHONLY, NULL, COLLISION_GROUP_PLAYER_MOVEMENT, &toptrace ); if ( bottomtrace.startsolid || toptrace.startsolid ) { if ( bottomtrace.startsolid ) { DevMsg( 1, "Warning, funcladder with blocked bottom point (%.2f %.2f %.2f) stuck in (%s)\n", m_vecPlayerMountPositionBottom.GetX(), m_vecPlayerMountPositionBottom.GetY(), m_vecPlayerMountPositionBottom.GetZ(), bottomtrace.m_pEnt ? UTIL_VarArgs( "%s/%s", bottomtrace.m_pEnt->GetClassname(), bottomtrace.m_pEnt->GetEntityName().ToCStr() ) //UTIL_VarArgs( "%s/%s", bottomtrace.m_pEnt->GetClassname(), STRING(bottomtrace.m_pEnt->GetEntityName()) ) ? : "NULL" ); } if ( toptrace.startsolid ) { DevMsg( 1, "Warning, funcladder with blocked top point (%.2f %.2f %.2f) stuck in (%s)\n", m_vecPlayerMountPositionTop.GetX(), m_vecPlayerMountPositionTop.GetY(), m_vecPlayerMountPositionTop.GetZ(), toptrace.m_pEnt ? UTIL_VarArgs( "%s/%s", toptrace.m_pEnt->GetClassname(), toptrace.m_pEnt->GetEntityName().ToCStr() ) //UTIL_VarArgs( "%s/%s", toptrace.m_pEnt->GetClassname(), STRING(toptrace.m_pEnt->GetEntityName()) ) ? : "NULL" ); } // Force geometry overlays on, but only if developer 2 is set... if ( developer.GetInt() > 1 ) { m_debugOverlays |= OVERLAY_TEXT_BIT; } } m_vecPlayerMountPositionTop -= GetAbsOrigin(); m_vecPlayerMountPositionBottom -= GetAbsOrigin(); // Compute mins, maxs of points // Vector mins( MAX_COORD_INTEGER, MAX_COORD_INTEGER, MAX_COORD_INTEGER ); Vector maxs( -MAX_COORD_INTEGER, -MAX_COORD_INTEGER, -MAX_COORD_INTEGER ); int i; for ( i = 0; i < 3; i++ ) { if ( m_vecPlayerMountPositionBottom.m_Value[ i ] < mins[ i ] ) { mins[ i ] = m_vecPlayerMountPositionBottom.m_Value[ i ]; } if ( m_vecPlayerMountPositionBottom.m_Value[ i ] > maxs[ i ] ) { maxs[ i ] = m_vecPlayerMountPositionBottom.m_Value[ i ]; } if ( m_vecPlayerMountPositionTop.m_Value[ i ] < mins[ i ] ) { mins[ i ] = m_vecPlayerMountPositionTop.m_Value[ i ]; } if ( m_vecPlayerMountPositionTop.m_Value[ i ] > maxs[ i ] ) { maxs[ i ] = m_vecPlayerMountPositionTop.m_Value[ i ]; } } // Expand mins/maxs by player hull size mins += playerMins; maxs += playerMaxs; UTIL_SetSize( this, mins, maxs ); m_bFakeLadder = HasSpawnFlags(SF_LADDER_DONTGETON); #endif }
//----------------------------------------------------------------------------- // Purpose: // Input : *pOther - //----------------------------------------------------------------------------- void CFlechette::BoltTouch( CBaseEntity *pOther ) { if ( !pOther->IsSolid() || pOther->IsSolidFlagSet(FSOLID_VOLUME_CONTENTS) || pOther->GetCollisionGroup() == COLLISION_GROUP_WEAPON ) return; DoAOEDamage(); trace_t tr; tr = BaseClass::GetTouchTrace(); // See if we struck the world if ( !( tr.surface.flags & SURF_SKY ) ) { if( (pOther->GetMoveType() == MOVETYPE_NONE || pOther->GetMoveType() == MOVETYPE_PUSH ) && !pOther->IsPlayer() && !pOther->IsNPC() ) EmitSound( "Weapon_Crossbow.BoltHitWorld" ); // if what we hit is static architecture, can stay around for a while. Vector vecDir = GetAbsVelocity(); SetThink( &CFlechette::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); //FIXME: We actually want to stick (with hierarchy) to what we've hit SetMoveType( MOVETYPE_NONE ); Vector vForward; AngleVectors( GetAbsAngles(), &vForward ); VectorNormalize ( vForward ); CEffectData data; data.m_vOrigin = tr.endpos; data.m_vNormal = vForward; data.m_nEntIndex = 0; data.m_nMaterial = m_nSkin; // Propriété inutilisée, on l'utilisera pour savoir quelle skin utiliser if(!pOther->IsPlayer() && !pOther->IsNPC()) { DispatchEffect( "FlechetteImpact", data ); } if(HL2MPRules()->IsTeamplay()) { if(GetOwnerEntity()->GetTeamNumber() == TEAM_PINK) DispatchParticleEffect( "gasgrenade_pink", tr.endpos, data.m_vAngles, this ); else DispatchParticleEffect( "gasgrenade_green", tr.endpos, data.m_vAngles, this ); } else DispatchParticleEffect( "gasgrenade_red", tr.endpos, data.m_vAngles, this ); UTIL_ImpactTrace( &tr, DMG_BULLET ); AddEffects( EF_NODRAW ); SetTouch( NULL ); SetThink( &CFlechette::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); // Shoot some sparks if ( UTIL_PointContents( GetAbsOrigin() ) != CONTENTS_WATER) { g_pEffects->Sparks( GetAbsOrigin() ); } } else { // Put a mark unless we've hit the sky if ( ( tr.surface.flags & SURF_SKY ) == false ) { UTIL_ImpactTrace( &tr, DMG_BULLET ); } UTIL_Remove( this ); } //} }
CWeaponBrawl::CWeaponBrawl() { AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Create a corpse //----------------------------------------------------------------------------- void CPropAPC2::CreateCorpse( ) { m_lifeState = LIFE_DEAD; for ( int i = 0; i < APC_MAX_GIBS; ++i ) { CPhysicsProp *pGib = assert_cast<CPhysicsProp*>(CreateEntityByName( "prop_physics_multiplayer" )); pGib->SetAbsOrigin( GetAbsOrigin() ); pGib->SetAbsAngles( GetAbsAngles() ); pGib->SetAbsVelocity( GetAbsVelocity() ); pGib->SetModel( s_pGibModelName[i] ); pGib->Spawn(); pGib->SetMoveType( MOVETYPE_VPHYSICS ); float flMass = pGib->GetMass(); /*if ( flMass < 200 ) {*/ Vector vecVelocity; pGib->GetMassCenter( &vecVelocity ); vecVelocity -= WorldSpaceCenter(); vecVelocity.z = fabs(vecVelocity.z); VectorNormalize( vecVelocity ); // Apply a force that would make a 100kg mass travel 150 - 300 m/s float flRandomVel = random->RandomFloat( 150, 300 ); vecVelocity *= (100 * flRandomVel) / flMass; vecVelocity.z += 100.0f; AngularImpulse angImpulse = RandomAngularImpulse( -500, 500 ); IPhysicsObject *pObj = pGib->VPhysicsGetObject(); if ( pObj != NULL ) { pObj->AddVelocity( &vecVelocity, &angImpulse ); } pGib->SetCollisionGroup( COLLISION_GROUP_DEBRIS ); /*}*/ //pGib->Ignite( 60, false ); pGib->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL ); } // CPropAPC2 *pAPC = (CPropAPC2 *)CreateEntityByName( "prop_vehicle_apc2" ); if ( pAPC ) { pAPC->InicialSpawn=m_vOriginalSpawnOrigin; pAPC->InicialAngle=m_vOriginalSpawnAngles; pAPC->m_bSpawn=true; pAPC->SetThink( &CPropAPC2::Materialize ); pAPC->SetContextThink( &CPropAPC2::Materialize, gpGlobals->curtime + 5.0f, "RESPAWNING" ); pAPC->SetNextThink( gpGlobals->curtime + 5.0f ); } else { Warning("Respawn failed to create %s!\n", GetClassname() ); } // AddSolidFlags( FSOLID_NOT_SOLID ); AddEffects( EF_NODRAW ); UTIL_Remove( this ); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) { if ( pOther->IsSolidFlagSet(FSOLID_VOLUME_CONTENTS | FSOLID_TRIGGER) ) { // Some NPCs are triggers that can take damage (like antlion grubs). We should hit them. if ( ( pOther->m_takedamage == DAMAGE_NO ) || ( pOther->m_takedamage == DAMAGE_EVENTS_ONLY ) ) return; } if ( pOther->m_takedamage != DAMAGE_NO ) { trace_t tr, tr2; tr = BaseClass::GetTouchTrace(); Vector vecNormalizedVel = GetAbsVelocity(); ClearMultiDamage(); VectorNormalize( vecNormalizedVel ); #if defined(HL2_EPISODIC) //!!!HACKHACK - specific hack for ep2_outland_10 to allow crossbow bolts to pass through her bounding box when she's crouched in front of the player // (the player thinks they have clear line of sight because Alyx is crouching, but her BBOx is still full-height and blocks crossbow bolts. if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() && pOther->Classify() == CLASS_PLAYER_ALLY_VITAL && FStrEq(STRING(gpGlobals->mapname), "ep2_outland_10") ) { // Change the owner to stop further collisions with Alyx. We do this by making her the owner. // The player won't get credit for this kill but at least the bolt won't magically disappear! SetOwnerEntity( pOther ); return; } #endif//HL2_EPISODIC if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() && pOther->IsNPC() ) { CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), sk_plr_dmg_crossbow.GetFloat(), DMG_NEVERGIB ); dmgInfo.AdjustPlayerDamageInflictedForSkillLevel(); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, tr.endpos, 0.7f ); dmgInfo.SetDamagePosition( tr.endpos ); pOther->DispatchTraceAttack( dmgInfo, vecNormalizedVel, &tr ); CBasePlayer *pPlayer = ToBasePlayer( GetOwnerEntity() ); if ( pPlayer ) { gamestats->Event_WeaponHit( pPlayer, true, "weapon_crossbow", dmgInfo ); } } else { CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), sk_plr_dmg_crossbow.GetFloat(), DMG_BULLET | DMG_NEVERGIB ); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, tr.endpos, 0.7f ); dmgInfo.SetDamagePosition( tr.endpos ); pOther->DispatchTraceAttack( dmgInfo, vecNormalizedVel, &tr ); } ApplyMultiDamage(); //Adrian: keep going through the glass. if ( pOther->GetCollisionGroup() == COLLISION_GROUP_BREAKABLE_GLASS ) return; /*if ( !pOther->IsAlive() ) { // We killed it! const surfacedata_t *pdata = physprops->GetSurfaceData( tr.surface.surfaceProps ); if ( pdata->game.material == CHAR_TEX_GLASS ) { return; } }*/ SetAbsVelocity( Vector( 0, 0, 0 ) ); // play body "thwack" sound EmitSound( "Weapon_Crossbow.BoltHitBody" ); Vector vForward; AngleVectors( GetAbsAngles(), &vForward ); VectorNormalize ( vForward ); UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + vForward * 128, MASK_BLOCKLOS, pOther, COLLISION_GROUP_NONE, &tr2 ); if ( tr2.fraction != 1.0f ) { // NDebugOverlay::Box( tr2.endpos, Vector( -16, -16, -16 ), Vector( 16, 16, 16 ), 0, 255, 0, 0, 10 ); // NDebugOverlay::Box( GetAbsOrigin(), Vector( -16, -16, -16 ), Vector( 16, 16, 16 ), 0, 0, 255, 0, 10 ); if ( tr2.m_pEnt == NULL || ( tr2.m_pEnt && tr2.m_pEnt->GetMoveType() == MOVETYPE_NONE ) ) { CEffectData data; data.m_vOrigin = tr2.endpos; data.m_vNormal = vForward; data.m_nEntIndex = tr2.fraction != 1.0f; DispatchEffect( "BoltImpact", data ); } } SetTouch( NULL ); SetThink( NULL ); if ( !g_pGameRules->IsMultiplayer() ) { UTIL_Remove( this ); } } else { trace_t tr; tr = BaseClass::GetTouchTrace(); // See if we struck the world if ( pOther->GetMoveType() == MOVETYPE_NONE && !( tr.surface.flags & SURF_SKY ) ) { EmitSound( "Weapon_Crossbow.BoltHitWorld" ); // if what we hit is static architecture, can stay around for a while. Vector vecDir = GetAbsVelocity(); float speed = VectorNormalize( vecDir ); // See if we should reflect off this surface float hitDot = DotProduct( tr.plane.normal, -vecDir ); if ( ( hitDot < 0.5f ) && ( speed > 100 ) ) { Vector vReflection = 2.0f * tr.plane.normal * hitDot + vecDir; QAngle reflectAngles; VectorAngles( vReflection, reflectAngles ); SetLocalAngles( reflectAngles ); SetAbsVelocity( vReflection * speed * 0.75f ); // Start to sink faster SetGravity( 1.0f ); } else { SetThink( &CCrossbowBolt::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); //FIXME: We actually want to stick (with hierarchy) to what we've hit SetMoveType( MOVETYPE_NONE ); Vector vForward; AngleVectors( GetAbsAngles(), &vForward ); VectorNormalize ( vForward ); CEffectData data; data.m_vOrigin = tr.endpos; data.m_vNormal = vForward; data.m_nEntIndex = 0; DispatchEffect( "BoltImpact", data ); UTIL_ImpactTrace( &tr, DMG_BULLET ); AddEffects( EF_NODRAW ); SetTouch( NULL ); SetThink( &CCrossbowBolt::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); if ( m_pGlowSprite != NULL ) { m_pGlowSprite->TurnOn(); m_pGlowSprite->FadeAndDie( 3.0f ); } } // Shoot some sparks if ( UTIL_PointContents( GetAbsOrigin() ) != CONTENTS_WATER) { g_pEffects->Sparks( GetAbsOrigin() ); } } else { // Put a mark unless we've hit the sky if ( ( tr.surface.flags & SURF_SKY ) == false ) { UTIL_ImpactTrace( &tr, DMG_BULLET ); } UTIL_Remove( this ); } } if ( g_pGameRules->IsMultiplayer() ) { // SetThink( &CCrossbowBolt::ExplodeThink ); // SetNextThink( gpGlobals->curtime + 0.1f ); } }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CGrenade_Molotov::Detonate( void ) { SetModelName( NULL_STRING ); //invisible AddSolidFlags( FSOLID_NOT_SOLID ); // intangible m_takedamage = DAMAGE_NO; trace_t trace; UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + Vector ( 0, 0, -128 ), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &trace); // Pull out of the wall a bit if ( trace.fraction != 1.0 ) { SetLocalOrigin( trace.endpos + (trace.plane.normal * (m_flDamage - 24) * 0.6) ); } int contents = UTIL_PointContents ( GetAbsOrigin() ); if ( (contents & MASK_WATER) ) { UTIL_Remove( this ); return; } EmitSound( "Grenade_Molotov.Detonate"); // Start some fires int i; QAngle vecTraceAngles; Vector vecTraceDir; trace_t firetrace; for( i = 0 ; i < 16 ; i++ ) { // build a little ray vecTraceAngles[PITCH] = random->RandomFloat(45, 135); vecTraceAngles[YAW] = random->RandomFloat(0, 360); vecTraceAngles[ROLL] = 0.0f; AngleVectors( vecTraceAngles, &vecTraceDir ); Vector vecStart, vecEnd; vecStart = GetAbsOrigin() + ( trace.plane.normal * 128 ); vecEnd = vecStart + vecTraceDir * 512; UTIL_TraceLine( vecStart, vecEnd, MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &firetrace ); Vector ofsDir = ( firetrace.endpos - GetAbsOrigin() ); float offset = VectorNormalize( ofsDir ); if ( offset > 128 ) offset = 128; //Get our scale based on distance float scale = 0.1f + ( 0.75f * ( 1.0f - ( offset / 128.0f ) ) ); float growth = 0.1f + ( 0.75f * ( offset / 128.0f ) ); if( firetrace.fraction != 1.0 ) { FireSystem_StartFire( firetrace.endpos, scale, growth, 30.0f, (SF_FIRE_START_ON|SF_FIRE_SMOKELESS|SF_FIRE_NO_GLOW), (CBaseEntity*) this, FIRE_NATURAL ); } } // End Start some fires CPASFilter filter2( trace.endpos ); te->Explosion( filter2, 0.0, &trace.endpos, g_sModelIndexFireball, 2.0, 15, TE_EXPLFLAG_NOPARTICLES, m_DmgRadius, m_flDamage ); CBaseEntity *pOwner; pOwner = GetOwnerEntity(); SetOwnerEntity( NULL ); // can't traceline attack owner if this is set UTIL_DecalTrace( &trace, "Scorch" ); UTIL_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START ); CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin(), BASEGRENADE_EXPLOSION_VOLUME, 3.0 ); RadiusDamage( CTakeDamageInfo( this, pOwner, m_flDamage, DMG_BLAST ), GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL ); AddEffects( EF_NODRAW ); SetAbsVelocity( vec3_origin ); SetNextThink( gpGlobals->curtime + 0.2 ); if ( m_pFireTrail ) { UTIL_Remove( m_pFireTrail ); } UTIL_Remove(this); }
void CSDKPlayer::FlashlightTurnOn( void ) { AddEffects( EF_DIMLIGHT ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSprite::Spawn( void ) { SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); m_flFrame = 0; Precache(); SetModel( STRING( GetModelName() ) ); CollisionProp()->SetSurroundingBoundsType( USE_GAME_CODE ); m_flMaxFrame = (float)modelinfo->GetModelFrameCount( GetModel() ) - 1; AddEffects( EF_NOSHADOW | EF_NORECEIVESHADOW ); #if defined( CLIENT_DLL ) SetNextClientThink( CLIENT_THINK_ALWAYS ); #endif #if !defined( CLIENT_DLL ) if ( GetEntityName() != NULL_STRING && !(m_spawnflags & SF_SPRITE_STARTON) ) { TurnOff(); } else #endif { TurnOn(); } // Worldcraft only sets y rotation, copy to Z if ( GetLocalAngles().y != 0 && GetLocalAngles().z == 0 ) { QAngle angles = GetLocalAngles(); angles.z = angles.y; angles.y = 0; SetLocalAngles( angles ); } // Clamp our scale if necessary float scale = m_flSpriteScale; if ( scale < 0 || scale > MAX_SPRITE_SCALE ) { #if !defined( CLIENT_DLL ) #ifndef _LINUX DevMsg( "LEVEL DESIGN ERROR: Sprite %s with bad scale %f [0..%f]\n", GetDebugName(), m_flSpriteScale, MAX_SPRITE_SCALE ); #endif #endif scale = clamp( m_flSpriteScale, 0, MAX_SPRITE_SCALE ); } //Set our state SetBrightness( m_clrRender->a ); SetScale( scale ); #if defined( CLIENT_DLL ) m_flStartScale = m_flDestScale = m_flSpriteScale; m_nStartBrightness = m_nDestBrightness = m_nBrightness; #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CBeam::TurnOn( void ) { AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPCEventResponseSystemEntity::Spawn( void ) { // Invisible, non solid. AddSolidFlags( FSOLID_NOT_SOLID ); AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Purpose: // Input : *pOther - //----------------------------------------------------------------------------- void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) { if ( !pOther->IsSolid() || pOther->IsSolidFlagSet(FSOLID_VOLUME_CONTENTS) ) return; if ( pOther->m_takedamage != DAMAGE_NO ) { trace_t tr, tr2; tr = BaseClass::GetTouchTrace(); Vector vecNormalizedVel = GetAbsVelocity(); ClearMultiDamage(); VectorNormalize( vecNormalizedVel ); if( GetOwnerEntity() && GetOwnerEntity()->IsPlayer() && pOther->IsNPC() ) { CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), m_iDamage, DMG_NEVERGIB ); dmgInfo.AdjustPlayerDamageInflictedForSkillLevel(); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, tr.endpos, 0.7f ); dmgInfo.SetDamagePosition( tr.endpos ); pOther->DispatchTraceAttack( dmgInfo, vecNormalizedVel, &tr ); } else { CTakeDamageInfo dmgInfo( this, GetOwnerEntity(), m_iDamage, DMG_BULLET | DMG_NEVERGIB ); CalculateMeleeDamageForce( &dmgInfo, vecNormalizedVel, tr.endpos, 0.7f ); dmgInfo.SetDamagePosition( tr.endpos ); pOther->DispatchTraceAttack( dmgInfo, vecNormalizedVel, &tr ); } ApplyMultiDamage(); //Adrian: keep going through the glass. if ( pOther->GetCollisionGroup() == COLLISION_GROUP_BREAKABLE_GLASS ) return; SetAbsVelocity( Vector( 0, 0, 0 ) ); // play body "thwack" sound EmitSound( "Weapon_Crossbow.BoltHitBody" ); Vector vForward; AngleVectors( GetAbsAngles(), &vForward ); VectorNormalize ( vForward ); UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + vForward * 128, MASK_OPAQUE, pOther, COLLISION_GROUP_NONE, &tr2 ); if ( tr2.fraction != 1.0f ) { // NDebugOverlay::Box( tr2.endpos, Vector( -16, -16, -16 ), Vector( 16, 16, 16 ), 0, 255, 0, 0, 10 ); // NDebugOverlay::Box( GetAbsOrigin(), Vector( -16, -16, -16 ), Vector( 16, 16, 16 ), 0, 0, 255, 0, 10 ); if ( tr2.m_pEnt == NULL || ( tr2.m_pEnt && tr2.m_pEnt->GetMoveType() == MOVETYPE_NONE ) ) { CEffectData data; data.m_vOrigin = tr2.endpos; data.m_vNormal = vForward; data.m_nEntIndex = tr2.fraction != 1.0f; DispatchEffect( "BoltImpact", data ); } } SetTouch( NULL ); SetThink( NULL ); UTIL_Remove( this ); } else { trace_t tr; tr = BaseClass::GetTouchTrace(); // See if we struck the world if ( pOther->GetMoveType() == MOVETYPE_NONE && !( tr.surface.flags & SURF_SKY ) ) { EmitSound( "Weapon_Crossbow.BoltHitWorld" ); // if what we hit is static architecture, can stay around for a while. Vector vecDir = GetAbsVelocity(); float speed = VectorNormalize( vecDir ); // See if we should reflect off this surface float hitDot = DotProduct( tr.plane.normal, -vecDir ); if ( ( hitDot < 0.5f ) && ( speed > 100 ) ) { Vector vReflection = 2.0f * tr.plane.normal * hitDot + vecDir; QAngle reflectAngles; VectorAngles( vReflection, reflectAngles ); SetLocalAngles( reflectAngles ); SetAbsVelocity( vReflection * speed * 0.75f ); // Start to sink faster SetGravity( 1.0f ); } else { SetThink( &CCrossbowBolt::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); //FIXME: We actually want to stick (with hierarchy) to what we've hit SetMoveType( MOVETYPE_NONE ); Vector vForward; AngleVectors( GetAbsAngles(), &vForward ); VectorNormalize ( vForward ); CEffectData data; data.m_vOrigin = tr.endpos; data.m_vNormal = vForward; data.m_nEntIndex = 0; DispatchEffect( "BoltImpact", data ); UTIL_ImpactTrace( &tr, DMG_BULLET ); AddEffects( EF_NODRAW ); SetTouch( NULL ); SetThink( &CCrossbowBolt::SUB_Remove ); SetNextThink( gpGlobals->curtime + 2.0f ); if ( m_pGlowSprite != NULL ) { m_pGlowSprite->TurnOn(); m_pGlowSprite->FadeAndDie( 3.0f ); } } // Shoot some sparks if ( UTIL_PointContents( GetAbsOrigin() ) != CONTENTS_WATER) { g_pEffects->Sparks( GetAbsOrigin() ); } } else { // Put a mark unless we've hit the sky if ( ( tr.surface.flags & SURF_SKY ) == false ) { UTIL_ImpactTrace( &tr, DMG_BULLET ); } UTIL_Remove( this ); } } if ( g_pGameRules->IsMultiplayer() ) { // SetThink( &CCrossbowBolt::ExplodeThink ); // SetNextThink( gpGlobals->curtime + 0.1f ); } }
void CAreaPortal::Spawn( void ) { AddEffects( EF_NORECEIVESHADOW | EF_NOSHADOW ); Precache(); }
void CRuleEntity::Spawn( void ) { SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); AddEffects( EF_NODRAW ); }
//----------------------------------------------------------------------------- // Purpose: Spawn the entity //----------------------------------------------------------------------------- void CNPC_CombineCamera::Spawn() { Precache(); SetModel(COMBINE_CAMERA_MODEL); m_pEyeFlash = CSprite::SpriteCreate(COMBINE_CAMERA_FLASH_SPRITE, GetLocalOrigin(), FALSE); m_pEyeFlash->SetTransparency(kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation); m_pEyeFlash->SetAttachment(this, 2); m_pEyeFlash->SetBrightness(0); m_pEyeFlash->SetScale(1.0); BaseClass::Spawn(); m_HackedGunPos = Vector(0, 0, 12.75); SetViewOffset(EyeOffset(ACT_IDLE)); m_flFieldOfView = CAMERA_FOV_WIDE; m_takedamage = DAMAGE_YES; m_iHealth = 50; m_bloodColor = BLOOD_COLOR_MECH; SetSolid(SOLID_BBOX); AddSolidFlags(FSOLID_NOT_STANDABLE); SetHeight(COMBINE_CAMERA_RETRACT_HEIGHT); AddFlag(FL_AIMTARGET); SetPoseParameter(COMBINE_CAMERA_BC_YAW, 0); SetPoseParameter(COMBINE_CAMERA_BC_PITCH, 0); m_iAmmoType = GetAmmoDef()->Index("Pistol"); // Create our eye sprite m_pEyeGlow = CSprite::SpriteCreate(COMBINE_CAMERA_GLOW_SPRITE, GetLocalOrigin(), false); m_pEyeGlow->SetTransparency(kRenderWorldGlow, 255, 0, 0, 128, kRenderFxNoDissipation); m_pEyeGlow->SetAttachment(this, 2); // Set our enabled state m_bEnabled = ((m_spawnflags & SF_COMBINE_CAMERA_STARTINACTIVE) == false); // Make sure the radii are sane. if (m_nOuterRadius <= 0) { m_nOuterRadius = 300; } if (m_nInnerRadius <= 0) { m_nInnerRadius = 450; } if (m_nOuterRadius < m_nInnerRadius) { swap(m_nOuterRadius, m_nInnerRadius); } // Do we start active? if (m_bEnabled) { Deploy(); } else { SetEyeState(CAMERA_EYE_DISABLED); } //Adrian: No shadows on these guys. AddEffects( EF_NOSHADOW ); // Stagger our starting times SetNextThink( gpGlobals->curtime + random->RandomFloat(0.1f, 0.3f) ); // Don't allow us to skip animation setup because our attachments are critical to us! SetBoneCacheFlags( BCF_NO_ANIMATION_SKIP ); }