local beam = Material( "models/alyx/emptool_glow" ) function EFFECT:Init( data ) self.DieTime = CurTime() + 0.1 self.StartPos = data:GetStart() self.EndPos = data:GetOrigin() self.Dir = self.EndPos - self.StartPos local vOffset = self.StartPos local Target1 = self.StartPos local Target = self.EndPos local size=10 NumParticles = 256 local emitter = ParticleEmitter( vOffset ) for i=0, NumParticles do local vPos = vOffset+Vector(math.Rand(-size,size),math.Rand(-size,size),math.Rand(-size,size)) local particle = emitter:Add( "effects/spark", vPos ) if (particle) then particle:SetVelocity( (Target-Target1):Normalize()*700 ) particle:SetLifeTime( 0 ) particle:SetDieTime( math.Rand( 0.5, 1.0 ) ) particle:SetStartAlpha( math.Rand( 200, 255 ) ) particle:SetEndAlpha( 0 ) particle:SetStartSize( 5 ) particle:SetEndSize( 0 ) particle:SetRoll( math.Rand(0, 360) ) particle:SetRollDelta( 0 ) particle:SetAirResistance( 100 ) particle:SetGravity( (Target-Target1):Normalize()*700 ) particle:SetCollide( true ) particle:SetBounce( 0.3 ) end end emitter:Finish() end function EFFECT:Think( ) if ( CurTime() > self.DieTime ) then return false end local dlight = DynamicLight( self:EntIndex() ) if ( dlight ) then local pos=self.EndPos dlight.Pos = pos dlight.r = 255 dlight.g = 255 dlight.b = 255 dlight.Brightness = 5 dlight.Decay = 500 dlight.Size = 1000 dlight.DieTime = CurTime() + 2 end return true end function EFFECT:Render() self.Entity:SetRenderBoundsWS( self.Entity:GetPos(), self.Entity:GetPos()+self.Entity:GetUp()*1000 ) render.SetMaterial(beam) render.DrawBeam(self.StartPos, self.EndPos, 10, 1, 1, Color(255,255,255)) for i=1,5 do render.DrawBeam(self.StartPos, self.EndPos+Vector(math.random(-50,50),math.random(-50,50),math.random(-50,50)), 5, 1, 1, Color(255,255,200)) end end