CapsAdmin

Untitled

Oct 17th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. local ENT = {}
  2. ENT.Type        = "anim"
  3. ENT.Base        = "base_anim"
  4. ENT.ClassName   = "hayashigs_christmas_tree"
  5. ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
  6.  
  7. local Maps = {
  8.  
  9.     aramaki_4d = Vector(-5833.9223632813, 6027.15625, -10238.447265625)
  10.  
  11. }
  12.  
  13. if SERVER then
  14.    
  15.     function ENT:Initialize()
  16.  
  17.         self:SetModel( "models/props_foliage/tree_pine_large.mdl" )
  18.         self:SetMoveType( 0 )
  19.         self:DrawShadow( true )
  20.         self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
  21.  
  22.     end
  23.    
  24.     local function Spawn()
  25.        
  26.         for _, v in pairs( ents.FindByClass( ENT.ClassName ) ) do
  27.             v:Remove()
  28.         end
  29.        
  30.         if Maps[game.GetMap()] then
  31.             local ENT = ents.Create( ENT.ClassName )
  32.                 ENT:SetPos( Maps[game.GetMap()] )
  33.                 ENT:SetAngles( Angle( 0, 0, 0 ) )
  34.                 ENT:Spawn()
  35.         end
  36.        
  37.     end
  38.     timer.Create( "hihihi", 3, 1, Spawn )
  39.    
  40. end
  41.  
  42. if CLIENT then
  43.    
  44.     local mat = Material( "particle/fire" )
  45.     local color = Color(255,255,255,255)
  46.     local pos = Vector(180,25,115)
  47.    
  48.     local data
  49.    
  50.     function ENT:Draw()
  51.         self:DrawModel()
  52.         render.SetMaterial( mat )
  53.    
  54.         if not data then
  55.        
  56.             data = {}
  57.            
  58.             for i = 1, 100 do
  59.                 local pi = (i/100)*math.pi
  60.                 local revi = (-i + 100) * 1.5
  61.                 local offset = Vector(0,0,100)
  62.                
  63.                 offset = offset + self:GetRight() * math.sin(pi*9) * revi
  64.                 offset = offset + self:GetForward() * math.cos(pi*9) * revi
  65.                 offset = offset + self:GetUp() * i * 6.5
  66.                
  67.                 local randsize = math.random() * 50
  68.                 local randpos = VectorRand() * 15
  69.                
  70.                 table.insert(data,
  71.                     {
  72.                         lpos = offset + randpos,
  73.                         sizex = revi/2 + randsize,
  74.                         sizey = revi/2 + randsize,
  75.                         color1 = HSVToColor((i/25)*300, 1, 1),
  76.                         color2 = HSVToColor((i/100)*100+130, 1, 1),
  77.                     }
  78.                 )
  79.             end
  80.            
  81.         else
  82.             local t = RealTime()
  83.             for _, params in pairs(data) do
  84.                 local wpos = LocalToWorld(params.lpos, Angle(0,0,0), self:GetPos(), self:GetAngles())
  85.                
  86.                 render.DrawSprite(wpos, params.sizex, params.sizey, t%2 > 1 and params.color1 or params.color2)
  87.             end
  88.         end
  89.     end
  90. end
  91.  
  92. scripted_ents.Register( ENT, ENT.ClassName, true )
Advertisement
Add Comment
Please, Sign In to add comment