Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. ENT.Type = "anim"
  2. ENT.PrintName = "M74 Incindiary"
  3. ENT.Author = "Generic Default"
  4. ENT.Contact = "AIDS"
  5. ENT.Purpose = "SPLODE"
  6. ENT.Instructions = "LAUNCH"
  7.  
  8. ENT.Spawnable = false
  9. ENT.AdminOnly = true
  10. ENT.DoNotDuplicate = true
  11. ENT.DisableDuplicator = true
  12.  
  13. if SERVER then
  14.  
  15. AddCSLuaFile( "shared.lua" )
  16.  
  17. function ENT:Initialize()
  18. self.CanTool = false
  19.  
  20. self.flightvector = self.Entity:GetForward() * ((115*52.5)/66)
  21. self.timeleft = CurTime() + 15
  22. self.Owner = self:GetOwner()
  23. self.Entity:SetModel( "models/Weapons/W_missile.mdl" )
  24. self.Entity:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
  25. self.Entity:SetMoveType( MOVETYPE_NONE ) --after all, gmod is a physics
  26. self.Entity:SetSolid( SOLID_VPHYSICS ) -- CHEESECAKE! >:3
  27. --self.Entity:SetColor(Color(45,55,40,255))
  28.  
  29. Glow = ents.Create("env_sprite")
  30. Glow:SetKeyValue("model","orangecore2.vmt")
  31. Glow:SetKeyValue("rendercolor","255 150 100")
  32. Glow:SetKeyValue("scale","0.3")
  33. Glow:SetPos(self.Entity:GetPos())
  34. Glow:SetParent(self.Entity)
  35. Glow:Spawn()
  36. Glow:Activate()
  37. self.Entity:SetNWBool("smoke", true)
  38. end
  39.  
  40. function ENT:Think()
  41.  
  42. if not IsValid(self) then return end
  43. if not IsValid(self.Entity) then return end
  44.  
  45. if self.timeleft < CurTime() then
  46. self.Entity:Remove()
  47. end
  48.  
  49. Table ={} //Table name is table name
  50. Table[1] =self.Owner //The person holding the gat
  51. Table[2] =self.Entity //The cap
  52.  
  53. local trace = {}
  54. trace.start = self.Entity:GetPos()
  55. trace.endpos = self.Entity:GetPos() + self.flightvector
  56. trace.filter = Table
  57. local tr = util.TraceLine( trace )
  58.  
  59.  
  60. if tr.HitSky then
  61. self.Entity:Remove()
  62. return true
  63. end
  64.  
  65. if tr.Hit then
  66. if not IsValid(self.Owner) then
  67. self.Entity:Remove()
  68. return
  69. end
  70. local effectdata = EffectData()
  71. effectdata:SetOrigin(tr.HitPos) // Where is hits
  72. effectdata:SetNormal(tr.HitNormal) // Direction of particles
  73. effectdata:SetEntity(self.Entity) // Who done it?
  74. effectdata:SetScale(1.3) // Size of explosion
  75. effectdata:SetRadius(tr.MatType) // What texture it hits
  76. effectdata:SetMagnitude(18) // Length of explosion trails
  77. util.Effect( "m9k_gdcw_tpaboom", effectdata )
  78. util.BlastDamage(self.Entity, self:OwnerGet(), tr.HitPos, 600, 170)
  79. util.Decal("Scorch", tr.HitPos + tr.HitNormal, tr.HitPos - tr.HitNormal)
  80. self.Entity:SetNWBool("smoke", false)
  81.  
  82. self:Explosion()
  83. self.Entity:Remove()
  84. end
  85.  
  86. self.Entity:SetPos(self.Entity:GetPos() + self.flightvector)
  87. self.flightvector = self.flightvector - (self.flightvector/500) + Vector(math.Rand(-0.2,0.2), math.Rand(-0.2,0.2),math.Rand(-0.1,0.1)) + Vector(0,0,-0.111)
  88. self.Entity:SetAngles(self.flightvector:Angle() + Angle(0,0,0))
  89. self.Entity:NextThink( CurTime() )
  90. return true
  91.  
  92. end
  93.  
  94. function ENT:Explosion()
  95.  
  96. if not IsValid(self.Owner) then
  97. self.Entity:Remove()
  98. return
  99. end
  100.  
  101. local effectdata = EffectData()
  102. effectdata:SetOrigin(self.Entity:GetPos())
  103. util.Effect("HelicopterMegaBomb", effectdata)
  104.  
  105. local shake = ents.Create("env_shake")
  106. shake:SetOwner(self.Owner)
  107. shake:SetPos(self.Entity:GetPos())
  108. shake:SetKeyValue("amplitude", "2000") // Power of the shake
  109. shake:SetKeyValue("radius", "900") // Radius of the shake
  110. shake:SetKeyValue("duration", "2.5") // Time of shake
  111. shake:SetKeyValue("frequency", "255") // How har should the screenshake be
  112. shake:SetKeyValue("spawnflags", "4") // Spawnflags(In Air)
  113. shake:Spawn()
  114. shake:Activate()
  115. shake:Fire("StartShake", "", 0)
  116. shake:Fire ( "Kill" , "", 3 )
  117.  
  118. local ar2Explo = ents.Create("env_ar2explosion")
  119. ar2Explo:SetOwner(self.Owner)
  120. ar2Explo:SetPos(self.Entity:GetPos())
  121. ar2Explo:Spawn()
  122. ar2Explo:Activate()
  123. ar2Explo:Fire("Explode", "", 0)
  124. ar2Explo:Fire ( "Kill" , "", 1 )
  125.  
  126. end
  127.  
  128. function ENT:OwnerGet()
  129. if IsValid(self.Owner) then
  130. return self.Owner
  131. else
  132. return self.Entity
  133. end
  134. end
  135.  
  136. end
  137.  
  138. if CLIENT then
  139. function ENT:Draw()
  140. self.Entity:DrawModel() // Draw the model.
  141. end
  142.  
  143. function ENT:Initialize()
  144. pos = self:GetPos()
  145. self.emitter = ParticleEmitter( pos )
  146. end
  147.  
  148. function ENT:Think()
  149. if (self.Entity:GetNWBool("smoke")) then
  150. pos = self:GetPos()
  151. for i=1, (1) do
  152. local particle = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), pos + (self:GetForward() * -120 * i))
  153. if (particle) then
  154. particle:SetVelocity((self:GetForward() * -2000)+(VectorRand()* 100) )
  155. particle:SetDieTime( math.Rand( 2, 5 ) )
  156. particle:SetStartAlpha( math.Rand( 7, 10 ) )
  157. particle:SetEndAlpha( 0 )
  158. particle:SetStartSize( math.Rand( 30, 40 ) )
  159. particle:SetEndSize( math.Rand( 130, 150 ) )
  160. particle:SetRoll( math.Rand(0, 360) )
  161. particle:SetRollDelta( math.Rand(-1, 1) )
  162. particle:SetColor( 200 , 200 , 200 )
  163. particle:SetAirResistance( 200 )
  164. particle:SetGravity( Vector( 100, 0, 0 ) )
  165. end
  166.  
  167. end
  168. end
  169. end
  170.  
  171.  
  172. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement