Are you a regular stikked user? Signup so you can keep track of your pastes!
  1. AddCSLuaFile('cl_init.lua')
  2. AddCSLuaFile('shared.lua')
  3. include('shared.lua')
  4.  
  5. local Model = "models/NightReaper/Ordinance/gbu-28_bunker_buster.mdl"
  6.  
  7. function ENT:SpawnFunction(ply, tr)
  8.     if (!tr.Hit) then
  9.                 return
  10.         end
  11.         local SpawnPos = tr.HitPos+tr.HitNormal*30
  12.         local ent = ents.Create("sent_gbu_28")
  13.         ent:SetPos(SpawnPos)
  14.         ent:SetVar("Owner",ply)
  15.         ent:Spawn()
  16.         ent:Activate()
  17.         return ent
  18. end
  19.  
  20. function ENT:Initialize()
  21.         self.Entity:SetModel(Model)
  22.         self.Entity:PhysicsInit(SOLID_VPHYSICS)
  23.         self.Entity:SetMoveType(MOVETYPE_VPHYSICS)     
  24.         self.Entity:SetSolid(SOLID_VPHYSICS)
  25.         self.Position = Vector()
  26.         local phys = self.Entity:GetPhysicsObject()
  27.         if phys:IsValid() then
  28.                 if (WireAddon != nil) then
  29.                         self.Inputs = Wire_CreateInputs(self.Entity,{"Detonate!"})
  30.                 end    
  31.                 phys:Wake()
  32.         end
  33. end
  34.  
  35. function ENT:TriggerInput(iname,value)
  36.         if (iname == "Detonate!") then
  37.                 if (value == 1) then
  38.                         self.Position=self.Entity:GetPos()
  39.                         self:Detonate()
  40.                 end
  41.         end
  42. end
  43.  
  44. function ENT:OnTakeDamage(dmginfo)
  45.         if (dmginfo:GetDamage() >= 25) then
  46.                 self:Detonate()
  47.         end
  48. end
  49.  
  50. function ENT:Detonate()
  51.         self:EmitSound("ambient/explosions/explode_4.wav", 500, 500)
  52.         local position = self.Position
  53.         local damage = 250
  54.         local radius = 500
  55.         local attacker = self.Owner
  56.         local inflictor = self.Entity
  57.         util.BlastDamage(inflictor, attacker, position, radius, damage)
  58.         for key,found in pairs(ents.FindInSphere(self.Entity:GetPos(),500)) do  
  59.                 found:Fire("enablemotion","",0)
  60.                 constraint.RemoveAll(found)
  61.                 if (found:GetMoveType() == 6 and found:GetPhysicsObject():IsValid()) then
  62.                         found:GetPhysicsObject():ApplyForceCenter(Vector(math.random(-1,1),math.random(-1,1),1):GetNormalized()*500)
  63.                 end
  64.         end
  65.         self.Entity:Remove()
  66. end
  67.  
  68. function ENT:Think()
  69. end
  70.  
  71. function ENT:OnRemove()
  72. end
  73.  
  74.  

Reply to "init.lua"

Here you can reply to the paste above

Create a snipurl

Make Private

Feeling clever? Set some advanced options.