Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setfenv(1, _G)
- hook.Add("Think",1,function()
- for key, ent in pairs(ents.GetAll()) do
- if ent:CPPIGetOwner() == me and (ent ~= me and ent:GetOwner() ~= me) then
- local r = ent:BoundingRadius() * 64
- for k,v in pairs(ents.FindInSphere(ent:GetPos(), r)) do
- if v ~= ent and v:CPPIGetOwner() == me and (v ~= me and v:GetOwner() ~= me) then
- local phys = v:GetPhysicsObject()
- if phys:IsValid() then
- if not v.st then
- v.st = true
- util.SpriteTrail(v, 0, HSVToColor(math.random()*360, 0.75, 1), true, r / (64*4), 0, 30, 0, "trails/laser.vmt")
- end
- phys:EnableGravity(false)
- phys:SetDamping(0,0)
- phys:SetMaterial("gmod_bouncy")
- local vel = (ent:GetPos() - v:GetPos()) / r
- local dir = vel:GetNormalized()
- local len = vel:Length()
- len = -len + 1
- len = len * math.pi
- len = len ^ math.pi * 4
- len = len / (math.pi * 16)
- vel = dir * len
- phys:AddVelocity(vel)
- --debugutils.Print(ent:EntIndex(), ent:GetPos(), vel:Length())
- end
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement