Advertisement
szymski

Untitled

Dec 6th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.58 KB | None | 0 0
  1.  
  2. ------------------Nebula---------------------
  3. local Spawn = function()       
  4.     rock = ents.Create("event_nebula")
  5.     rock:SetPos(LDE.Anons:PointInSpace(rock.Data))
  6.     rock:Spawn()
  7. end
  8. local Int = function(self)         
  9.     self:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" )
  10.     self:PhysicsInit(SOLID_VPHYSICS)
  11.     self:SetMoveType(MOVETYPE_VPHYSICS)
  12.     self:SetSolid(SOLID_VPHYSICS)
  13.     local phys = self:GetPhysicsObject()
  14.     if (phys:IsValid()) then
  15.         phys:Wake()
  16.         phys:EnableMotion(false)
  17.         phys:EnableCollisions(false)
  18.     end
  19.     self:SetColor(0,0,0,0)
  20. end
  21. local Client = function(ENT)
  22.     function ENT:Think() --hackhackhackhackhackhackhackhackhackhackhackhackhackhackhack D:
  23.         if self.lol == nil then
  24.             self:Cloud()
  25.             self.lol = true
  26.         end
  27.     end
  28.  
  29.     function ENT:Cloud()
  30.       local effectdata = EffectData()
  31.             effectdata:SetOrigin( self:GetPos() )
  32.             effectdata:SetScale( 6 )
  33.             effectdata:SetMagnitude( 100 ) --75
  34.             //The starting color for the particles. Needed a vector, and I found one.
  35.             effectdata:SetStart( Vector(math.random(0,255),math.random(0,255),math.random(0,255)))
  36.             //The color variance of particles. Needed another 3 part datatype, lol. So I cheated.
  37.             effectdata:SetAngles( Angle(math.random(0,255),math.random(0,255),math.random(0,255)) )
  38.             util.Effect( "env_nebula" , effectdata )
  39.     end
  40. end
  41. local Data={name="Nebula",class="event_nebula",Type="Space",Initial=true,Mega=true,Client=Client,Startup=Int,ThinkSpeed=1,SpawnMe=Spawn}
  42. LDE.Anons.GenerateAnomaly(Data)
  43.  
  44. -----------HyperMass--------------
  45. local Spawn = function()    
  46.     rock = ents.Create("hypermass")
  47.     rock:SetPos(LDE.Anons:PointInSpace(rock.Data))
  48.     rock:Spawn()   
  49. end
  50. local Int = function(self) 
  51.     self:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" )
  52.     self:PhysicsInit(SOLID_VPHYSICS)
  53.     self:SetMoveType(MOVETYPE_VPHYSICS)
  54.     self:SetSolid(SOLID_VPHYSICS)
  55.     self:SetMaterial("debug/env_cubemap_model")
  56.     local phys = self:GetPhysicsObject()
  57.     if (IsValid(phys)) then
  58.         phys:EnableMotion(false)
  59.     end
  60. end
  61. local Client = function(ENT)
  62.     function ENT:Think()
  63.         if self.lol == nil then
  64.             self:Streams()
  65.             self.lol = true
  66.         end
  67.     end
  68.  
  69.     function ENT:Streams()
  70.         local JetColor = math.random(1,5)
  71.         local RingColor = math.random(1,4)
  72.        
  73.         local effect = EffectData()
  74.         effect:SetEntity(self)
  75.         util.Effect("hypermass_pinch",effect)
  76.         effect:SetScale(RingColor)
  77.         util.Effect("hypermass_centerring",effect)
  78.        
  79.         effect:SetMagnitude(1)
  80.         effect:SetScale(RingColor)
  81.         util.Effect("hypermass_ring",effect)
  82.            
  83.         effect:SetScale(JetColor)
  84.         util.Effect("hypermass_jet",effect)
  85.        
  86.         effect:SetMagnitude(0)
  87.         effect:SetScale(RingColor)
  88.         util.Effect("hypermass_ring",effect)
  89.  
  90.         effect:SetScale(JetColor)
  91.         util.Effect("hypermass_jet",effect)
  92.        
  93.     end
  94. end
  95. local Touch = function(self,activator) self:Blackhole(activator) end
  96. local Think = function(self)
  97.     local ents = ents.FindInSphere(self:GetPos(),self.Radius)
  98.     for _,v in pairs(ents) do
  99.         if IsValid(v) and v:EntIndex()~=self:EntIndex() then
  100.             local range = v:GetPos():Distance(self:GetPos())
  101.             local dir = (v:GetPos()-self:GetPos()) --LDE:Normalise(v:GetPos()-ent:GetPos())
  102.             dir:Normalize()
  103.            
  104.             if not LDE:IsImmune(v) and not LDE:IsInSafeZone(v) then
  105.                 if(range<80)then self:Blackhole(v) end
  106.                
  107.                 if v:IsPlayer() and v:Alive() then 
  108.                     local pow= (self.Power*self:GetPhysicsObject():GetMass()/range+1^2)
  109.                     local force = (dir*Vector(-pow,-pow,-pow))*(self.Radius/range)
  110.                     v:SetVelocity(force)
  111.                 else
  112.                     local phys = v:GetPhysicsObject()
  113.                     if math.random(1,15) == 1 then
  114.                         if (phys:IsValid()) then
  115.                             phys:EnableMotion(true)
  116.                             phys:Wake()
  117.                         end
  118.                     end
  119.                    
  120.                     --print(self.Power*(range/self.Radius))
  121.                     --print("P: "..self.Power.." range: "..range.." radius: "..self.Radius.." D/R: "..range/self.Radius.." R/D: "..self.Radius/range)
  122.                    
  123.                    
  124.                     LDE:DealDamage(v,(self.Power/1000)*(self.Radius/range),self,self,false)
  125.                    
  126.                     if(IsValid(self:GetPhysicsObject())) then
  127.                         local dir = (v:GetPos()-self:GetPos())
  128.                         local pow= (self.Power*self:GetPhysicsObject():GetMass()/range+1^2)
  129.                         local force = (dir*Vector(-pow,-pow,-pow))*(self.Radius/range)
  130.                         self:GetPhysicsObject():ApplyForceCenter(force)
  131.                         --Msg("Applying force! \n")
  132.                     end
  133.                 end
  134.             end
  135.         end
  136.     end
  137. end
  138.  
  139. local Server = function(ENT)
  140.    
  141.     ENT.StartingPower = 500
  142.     ENT.StartingRadius = 2500
  143.     ENT.MaximumPower = 1000000
  144.     ENT.MaximumRadius = 7000
  145.     ENT.Power = 500
  146.     ENT.Radius = 2500  
  147.     ENT.NoLDEDamage = true
  148.     ENT.Exploded = false
  149.    
  150.     function ENT:Explode()
  151.         if(self.Exploded)then return end
  152.         self.Exploded = true
  153.         local effectdata = EffectData()
  154.         effectdata:SetMagnitude( 1 )
  155.        
  156.         local Pos = self:GetPos()
  157.        
  158.         effectdata:SetOrigin( Pos )
  159.         effectdata:SetScale( self.Radius )
  160.         util.Effect( "LDE_coredeath", effectdata )
  161.         local players = player.GetAll()
  162.         for _, ply in pairs( players ) do
  163.             ply:EmitSound( "explode_9" )
  164.         end
  165.         self:EmitSound( "explode_9" )
  166.        
  167.         local Boom = {
  168.             Pos                     =       Pos,    --Required--        --Position of the Explosion, World vector
  169.             ShrapDamage =       self.Power,                                     --Amount of Damage dealt by each Shrapnel that hits, if 0 or nil then other Shap vars are not required
  170.             ShrapCount      =       10,                                     --Number of Shrapnel, 0 to not use Shrapnel
  171.             ShrapDir            =       self:GetForward(),                          --Direction of the Shrapnel, Direction vector, Example: Missile:GetForward()
  172.             ShrapCone       =       180,                                        --Cone Angle the Shrapnel is randomly fired into, 0-180, 0 for all to be released directly forward, 180 to be released in a sphere
  173.             ShrapRadius     =       self.Radius,                                        --How far the Shrapnel travels
  174.             ShockDamage =       self.Power,             --Required--        --Amount of Shockwave Damage, if 0 or nil then other Shock vars are not required
  175.             ShockRadius     =       self.Radius,                                        --How far the Shockwave travels in a sphere
  176.             Ignore              =       self,                                   --Optional Entity that Shrapnel and Shockwaves ignore, Example: A missile entity so that Shrapnel doesn't hit it before it's removed
  177.             Inflictor               =       self,           --Required--        --The weapon or player that is dealing the damage
  178.             Owner               =       self        --Required--        --The player that owns the weapon, or the Player if the Inflictor is a player
  179.         }
  180.         LDE:BlastDamage(Boom)
  181.        
  182.         --[[ Disabling this, implementing new system to get this.
  183.         local Resources = {Blackholium={amount=10,name="Blackholium"}}
  184.         local scrap = ents.Create("resource_clump")
  185.             scrap:SetPos(self:GetPos()+Vector(math.random(-10,10),math.random(-10,10),math.random(-10,10)))
  186.             scrap:SetModel( self:GetModel() )
  187.             scrap:Spawn()
  188.             scrap.Resources=Resources
  189.             scrap.NoLDEDamage=true
  190.             scrap:SetMaterial("debug/env_cubemap_model")
  191.             local delay = (math.random(900, 1800))
  192.             scrap:Fire("break","",tostring(delay + 10))
  193.             scrap:Fire("kill","",tostring(delay + 10))
  194.         ]]
  195.         self:Remove()
  196.     end
  197.    
  198.     function ENT:Blackhole(ent)
  199.         if not IsValid(ent) then return end
  200.         if not LDE:IsImmune(ent) and not LDE:IsInSafeZone(v) then
  201.             if ent:IsPlayer() then
  202.                 if(ent:Alive())then--Only kill living players.
  203.                     ent:Kill()
  204.                 end        
  205.             else
  206.                 local mass = 0
  207.                 local phyx = ent:GetPhysicsObject()
  208.                 if(IsValid(phyx))then mass =(phyx:GetMass()/10) end
  209.  
  210.                 self.Power=self.Power+mass
  211.                 self.Radius=math.Clamp(self.Radius+mass,self.StartingRadius,self.MaximumRadius)
  212.                 ent:Remove()
  213.             end
  214.         end
  215.         if(self.Power>=self.MaximumPower)then self:Explode() end
  216.     end
  217. end
  218.  
  219. local Data={name="BlackHole",class="hypermass",Type="Space",Touch=Touch,Think=Think,Server=Server,Client=Client,Startup=Int,ThinkSpeed=0.05,SpawnMe=Spawn,minimal=1}
  220. LDE.Anons.GenerateAnomaly(Data)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement