Advertisement
CapsAdmin

Untitled

Jan 26th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. setfenv(1, _G)
  2. hook.Add("Think",1,function()
  3.     for key, ent in pairs(ents.GetAll()) do
  4.         if ent:CPPIGetOwner() == me and (ent ~= me and ent:GetOwner() ~= me) then
  5.             local r = ent:BoundingRadius() * 64
  6.             for k,v in pairs(ents.FindInSphere(ent:GetPos(), r)) do
  7.                 if v ~= ent and v:CPPIGetOwner() == me and (v ~= me and v:GetOwner() ~= me) then
  8.                     local phys = v:GetPhysicsObject()
  9.                     if phys:IsValid() then
  10.                        
  11.                         if not v.st then
  12.                             v.st = true
  13.                             util.SpriteTrail(v, 0, HSVToColor(math.random()*360, 0.75, 1), true, r / (64*4), 0, 30, 0, "trails/laser.vmt") 
  14.                         end
  15.                            
  16.                         phys:EnableGravity(false)
  17.                         phys:SetDamping(0,0)
  18.                         phys:SetMaterial("gmod_bouncy")
  19.                         local vel = (ent:GetPos() - v:GetPos()) / r
  20.                         local dir = vel:GetNormalized()
  21.                         local len = vel:Length()
  22.                            
  23.                         len = -len + 1
  24.                         len = len * math.pi
  25.                         len = len ^ math.pi * 4
  26.                         len = len / (math.pi * 16)
  27.                        
  28.                         vel = dir * len
  29.                            
  30.                         phys:AddVelocity(vel)
  31.                         --debugutils.Print(ent:EntIndex(), ent:GetPos(), vel:Length())
  32.                     end            
  33.                 end
  34.             end
  35.         end
  36.     end
  37. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement