Advertisement
Guest User

Untitled

a guest
May 4th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 KB | None | 0 0
  1. function EFFECT:Init( data )
  2. if GetConVarNumber( "sh_fx_detailedimpacteffects" ) == 0 then
  3. return end
  4.  
  5. local eyepos = LocalPlayer():EyePos()
  6. local aim = LocalPlayer():GetAimVector()
  7. local Pos = data:GetOrigin()
  8. local Norm = data:GetNormal()
  9. local Scale = data:GetScale()* math.Rand( 10, 20 )
  10. local SurfaceColor = render.GetSurfaceColor( Pos+Norm, Pos-Norm*100 ) * 255
  11. SurfaceColor.r = math.Clamp( SurfaceColor.r+20, 0, 255 )
  12. SurfaceColor.g = math.Clamp( SurfaceColor.g+20, 0, 255 )
  13. SurfaceColor.b = math.Clamp( SurfaceColor.b+20, 0, 255 )
  14. local Dist = LocalPlayer():GetPos():Distance( Pos )
  15. local FleckSize = math.Clamp( Dist * 0.01, 8, 64 )
  16. local emitter = ParticleEmitter( Pos + Norm * 32 )
  17. emitter:SetNearClip( 0, 128 )
  18.  
  19. if GetConVarNumber( "sh_fx_smokeyimpacteffects" ) == 1 then
  20. if math.random( 1, 4 ) == 1 then
  21. for i=1, 1 do
  22.  
  23. local particle = emitter:Add( "effects/dust", Pos + Norm * 1 )
  24. particle:SetVelocity( Norm * math.Rand( 4, 8 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  25. particle:SetDieTime( math.Rand( 30, 50 ) )
  26. particle:SetStartAlpha(math.Rand( 100, 150 ))
  27. particle:SetStartSize( math.Rand( 10, 15 ) )
  28. particle:SetEndSize( math.Rand (100, 150) )
  29. particle:SetRoll( math.Rand ( -1000, 1000) )
  30. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  31. particle:SetGravity( Vector( 0, 0, 0 ) )
  32. particle:SetAirResistance( math.Rand (5, 10) )
  33. particle:SetCollide(true)
  34. particle:SetBounce(0.1)
  35. end
  36. end
  37. end
  38. for i=1, 2 do
  39.  
  40. local particle = emitter:Add( "effects/dust", Pos + Norm * 1 )
  41. particle:SetVelocity( Norm * math.Rand( 50, 100 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  42. particle:SetDieTime( math.Rand( 0.05, 0.2 ) )
  43. particle:SetStartAlpha(255)
  44. particle:SetStartSize( math.Rand( 10, 15 ) )
  45. particle:SetEndSize( math.Rand (30, 40) )
  46. particle:SetRoll( math.Rand ( -1000, 1000) )
  47. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  48. particle:SetGravity( Vector( 0, 0, math.Rand( 300, 0 ) ) )
  49. particle:SetAirResistance( math.Rand (1000, 1200) )
  50. particle:SetCollide(true)
  51. particle:SetBounce(0.1)
  52. end
  53.  
  54. for i=1, 1 do
  55.  
  56. local particle = emitter:Add( "effects/dust", Pos + Norm * 1 )
  57. particle:SetVelocity( Norm * math.Rand( 50, 100 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  58. particle:SetDieTime( math.Rand( 0.1, 0.2 ) )
  59. particle:SetStartAlpha(255)
  60. particle:SetStartSize( math.Rand( 10, 15 ) )
  61. particle:SetEndSize( math.Rand (20, 30) )
  62. particle:SetRoll( math.Rand ( -1000, 1000) )
  63. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  64. particle:SetGravity( Vector( 0, 0, math.Rand( 300, 0 ) ) )
  65. particle:SetAirResistance( math.Rand (1000, 1200) )
  66. particle:SetCollide(true)
  67. particle:SetBounce(0.1)
  68. end
  69.  
  70. for i=1, 5 do
  71.  
  72. local particle = emitter:Add( "effects/dust2", Pos + Norm * 1 )
  73. particle:SetVelocity( Norm * math.Rand( 300, 600 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  74. particle:SetDieTime( math.Rand( 0.2, 0.5 ) )
  75. particle:SetStartAlpha(math.Rand(150,255))
  76. particle:SetStartSize( math.Rand( 1, 5 ) )
  77. particle:SetEndSize( math.Rand (10, 15) )
  78. particle:SetRoll( math.Rand ( -1000, 1000) )
  79. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  80. particle:SetGravity( Vector( 0, 0, math.Rand( 300, 0 ) ) )
  81. particle:SetAirResistance( math.Rand (1000, 1200) )
  82. particle:SetCollide(true)
  83. particle:SetBounce(0.1)
  84. end
  85.  
  86. for i=1, 5 do
  87.  
  88. local particle = emitter:Add( "effects/dust2", Pos + Norm * 1 )
  89. particle:SetVelocity( Norm * math.Rand( 300, 600 ) + VectorRand() * (math.Rand( 1, 5 )*100) )
  90. particle:SetDieTime( math.Rand( 0.2, 0.5 ) )
  91. particle:SetStartAlpha(255)
  92. particle:SetStartSize( math.Rand( 1, 5 ) )
  93. particle:SetEndSize( math.Rand (5, 10) )
  94. particle:SetRoll( math.Rand ( -1000, 1000) )
  95. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  96. particle:SetGravity( Vector( 0, 0, math.Rand( 300, 0 ) ) )
  97. particle:SetAirResistance( math.Rand (1000, 1200) )
  98. particle:SetCollide(true)
  99. particle:SetBounce(0.1)
  100. end
  101.  
  102.  
  103. if math.random( 1, 10 ) == 1 then
  104. timer.Simple(math.Rand(0.5,1), function()
  105. for i=1, 1 do
  106.  
  107. local particle = emitter:Add( "effects/fleck_cement2", Pos + Norm * 1 )
  108. particle:SetVelocity( Norm * math.Rand( 2, 4 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  109. particle:SetDieTime( math.Rand( 5, 10 ) )
  110. particle:SetStartAlpha( 255 )
  111. particle:SetStartSize( 2 )
  112. particle:SetEndSize( 2 )
  113. particle:SetRoll( math.Rand ( -100, 100) )
  114. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  115. particle:SetGravity( Vector( 0, 0, -600 ))
  116. particle:SetAirResistance( 0 )
  117. particle:SetCollide(true)
  118. particle:SetBounce(0.3)
  119. end
  120. end)
  121.  
  122. timer.Simple(math.Rand(1.2,2), function()
  123. for i=1, 1 do
  124.  
  125. local particle = emitter:Add( "effects/fleck_cement1", Pos + Norm * 1 )
  126. particle:SetVelocity( Norm * math.Rand( 2, 4 ) + VectorRand() * (math.Rand( 1, 5 )*1) )
  127. particle:SetDieTime( math.Rand( 5, 10 ) )
  128. particle:SetStartAlpha( 255 )
  129. particle:SetStartSize( 1 )
  130. particle:SetEndSize( 1 )
  131. particle:SetRoll( math.Rand ( -100, 100) )
  132. particle:SetColor( SurfaceColor.r, SurfaceColor.g, SurfaceColor.b )
  133. particle:SetGravity( Vector( 0, 0, -600 ))
  134. particle:SetAirResistance( 0 )
  135. particle:SetCollide(true)
  136. particle:SetBounce(0.3)
  137. end
  138. end)
  139. end
  140.  
  141.  
  142.  
  143. emitter:Finish()
  144. end
  145.  
  146. function EFFECT:Think( )
  147. return false
  148. end
  149.  
  150. function EFFECT:Render()
  151. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement