Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. function ENT:Initialize()
  2.  
  3. self:SetModel( "models/naval/hedgehog_launcher.mdl" )
  4. self:SetAngles( Angle ( 0, 0, 0 ))
  5. self:PhysicsInit( SOLID_VPHYSICS )
  6. self:SetMoveType( MOVETYPE_VPHYSICS )
  7. self:SetSolid( SOLID_VPHYSICS )
  8. self.Inputs = WireLib.CreateSpecialInputs(self, {"Fire","Reload"}, {"NORMAL","NORMAL"})
  9.  
  10. local bombPositions = {Vector( 58.6445, 31.2136, 19.7565 ) , Vector(41.8027, 31.5862, 20.5107 ) , Vector( 24.9608, 31.9587, 21.265 ) , Vector( 8.1189, 32.3313, 22.0192 ) , Vector( -8.723, 32.7038, 22.7735 ) , Vector(-25.5648, 33.0764, 23.5278 ) , Vector( 58.6445, 11.3196, 19.7565 ) , Vector(41.8027, 11.6922, 20.5107 ) , Vector(24.9608, 12.0647, 21.265 ) , Vector(8.1189, 12.4372, 22.0192 ) , Vector(-8.723, 12.8098, 22.7735 ) , Vector(-25.5648, 13.3965, 23.5278 ) , Vector( 58.6445, -10.4592, 19.7565 ) , Vector(41.8027, -10.7572, 20.5107 ) , Vector(24.9608, -11.3533, 21.265 ) , Vector(8.1189, -12.0239, 22.0192 ) , Vector(-8.723, -12.5901, 22.7735 ) , Vector(-25.5648, -13.3965, 23.5278 ) , Vector( 58.6445, -30.5651, 19.7565 ) , Vector(41.8027, -30.8632, 20.5107 ) , Vector(24.9608, -31.4593, 21.265 ) , Vector(8.1189, -32.1298, 22.0192 ) , Vector(-8.723, -32.6961, 22.7735 ) , Vector(-25.5648, -33.2905, 23.5278 ) } // Introduce all the positions here replacing the a b c for the actual numbers.
  11.  
  12.  
  13.  
  14.  
  15. local phys = self:GetPhysicsObject()
  16. if (phys:IsValid()) then
  17. phys:Wake()
  18. end
  19.  
  20. end
  21.  
  22.  
  23. function ENT:Use( activator, caller )
  24. return
  25. end
  26.  
  27. function ENT:Think()
  28. function self:TriggerInput(iname, value)
  29. if (iname == "Fire") then
  30. for k, v in pairs( ents.FindByModel( "models/naval/hedgehog.mdl" ) ) do
  31. if math.Distance( self:GetPos().x, self:GetPos().y, v:GetPos().x, v:GetPos().y ) < 80 then
  32.  
  33. v:Remove()
  34. self.fire = value
  35. elseif (iname == "Reload") then
  36. self.Reload = value
  37.  
  38. for i=1, 24 do
  39.  
  40. local ent = ents.Create("prop_physics")
  41. ent:SetModel( "models/naval/hedgehog.mdl" )
  42. ent:SetMoveType( MOVETYPE_VPHYSICS )
  43. ent:PhysicsInit( SOLID_VPHYSICS )
  44. ent:SetSolid( SOLID_VPHYSICS )
  45. ent:Spawn()
  46.  
  47.  
  48.  
  49.  
  50. ent:SetLocalPos( Vector(bombPositions[i]) )
  51.  
  52. local p, y
  53.  
  54. p = -( 45 - 5 * (i - 1) + (30 * (math.ceil(i/6)-1)))
  55.  
  56.  
  57.  
  58. if i <= 6 then
  59.  
  60. y = ( 2 * i + 1.5 )
  61.  
  62. elseif i <= 12 then
  63.  
  64. y = (( 2 * i + 0.5 ) - 6 * 2 )
  65.  
  66. elseif i <= 18 then
  67.  
  68. y =-(( 2 * i + 0.5 ) - 12 * 2)
  69.  
  70. elseif i <= 24 then
  71.  
  72. y =-(( 2 * i + 1.5) - 18 * 2)
  73.  
  74.  
  75. end
  76.  
  77. r = ( 0 )
  78.  
  79. ent:SetParent(self, -1)
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. end
  88. end end
  89.  
  90.  
  91.  
  92. end
  93. end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement