Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. AddCSLuaFile("cl_init.lua")
  2. AddCSLuaFile("shared.lua")
  3. include("shared.lua")
  4.  
  5. function ENT:Initialize()
  6. self:SetModel("models/items/quake1/alaser.mdl")
  7. self:SetCollisionGroup(COLLISION_GROUP_PROJECTILE)
  8. local mins, maxs = Vector(-8, -1, -1), Vector(8, 1, 1)
  9. self:PhysicsInitBox(mins, maxs)
  10. self:SetMoveType(MOVETYPE_VPHYSICS)
  11. self:SetSolid(SOLID_CUSTOM)
  12. self:DrawShadow(false)
  13.  
  14. local glow = ents.Create("env_sprite")
  15. glow:SetKeyValue("rendercolor","255 0 60")
  16. glow:SetKeyValue("GlowProxySize","2")
  17. glow:SetKeyValue("HDRColorScale","1")
  18. glow:SetKeyValue("renderfx","14")
  19. glow:SetKeyValue("rendermode","3")
  20. glow:SetKeyValue("renderamt","100")
  21. glow:SetKeyValue("model","sprites/flare1.spr")
  22. glow:SetKeyValue("scale","1.2")
  23. glow:Spawn()
  24. glow:SetParent(self)
  25. glow:SetPos(self:GetPos())
  26.  
  27. local phys = self:GetPhysicsObject()
  28. if IsValid(phys) then
  29. phys:SetMaterial("default_silent")
  30. phys:Wake()
  31. phys:SetMass(1)
  32. phys:EnableDrag(false)
  33. phys:EnableGravity(false)
  34. phys:SetBuoyancyRatio(0)
  35. end
  36.  
  37. self.Die = false
  38. end
  39.  
  40. function ENT:SetDamage(dmg)
  41. self.Damage = dmg
  42. end
  43.  
  44. function ENT:PhysicsCollide(data, physobj)
  45. local start = data.HitPos + data.HitNormal
  46. local endpos = data.HitPos - data.HitNormal
  47. util.Decal("fadingscorch", start, endpos)
  48. data.HitEntity:TakeDamage(self.Damage, self.Entity:GetOwner())
  49. self.Die = true
  50. end
  51.  
  52. function ENT:Think()
  53. if self.Die == true then
  54. self:Remove()
  55. end
  56. end
  57.  
  58. function ENT:OnRemove()
  59. if self.sound then self.sound:Stop() end
  60. local effectdata = EffectData()
  61. effectdata:SetOrigin(self.endpos or self:GetPos())
  62. self:EmitSound("weapons/enfstop.wav")
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement