void CLightning::DamageThink( void ) { pev->nextthink = gpGlobals->time + 0.1; TraceResult tr; UTIL_TraceLine( GetStartPos(), GetEndPos(), dont_ignore_monsters, NULL, &tr ); BeamDamage( &tr ); }
void CLaser::FireAtPoint(TraceResult &tr) { SetEndPos(tr.vecEndPos); if(m_pSprite) UTIL_SetOrigin(m_pSprite->pev, tr.vecEndPos); BeamDamage(&tr); DoSparks(GetStartPos(), tr.vecEndPos); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvLaser::FireAtPoint( trace_t &tr ) { SetAbsEndPos( tr.endpos ); if ( m_pSprite ) { UTIL_SetOrigin( m_pSprite, tr.endpos ); } // Apply damage and do sparks every 1/10th of a second. if ( gpGlobals->curtime >= m_flFireTime + 0.1 ) { BeamDamage( &tr ); DoSparks( GetAbsStartPos(), tr.endpos ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvBeam::UpdateThink( void ) { // Apply damage every 1/10th of a second. if ( ( m_flDamage > 0 ) && ( gpGlobals->curtime >= m_flFireTime + 0.1 ) ) { trace_t tr; UTIL_TraceLine( GetAbsStartPos(), GetAbsEndPos(), MASK_SOLID, NULL, COLLISION_GROUP_NONE, &tr ); BeamDamage( &tr ); // BeamDamage calls RelinkBeam, so no need to call it again. } else { RelinkBeam(); } if( m_TouchType != touch_none ) { trace_t tr; Ray_t ray; ray.Init( GetAbsStartPos(), GetAbsEndPos() ); if( m_TouchType == touch_player_or_npc_or_physicsprop ) { CTraceFilterPlayersNPCsPhysicsProps traceFilter; enginetrace->TraceRay( ray, MASK_SHOT, &traceFilter, &tr ); } else { CTraceFilterPlayersNPCs traceFilter; enginetrace->TraceRay( ray, MASK_SHOT, &traceFilter, &tr ); } if( tr.fraction != 1.0 && PassesTouchFilters( tr.m_pEnt ) ) { m_OnTouchedByEntity.FireOutput( tr.m_pEnt, this, 0 ); return; } } SetNextThink( gpGlobals->curtime ); }