Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ENT = {}
- ENT.Type = "anim"
- ENT.Base = "base_anim"
- ENT.ClassName = "hayashigs_christmas_tree"
- ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
- local Maps = {
- aramaki_4d = Vector(-5833.9223632813, 6027.15625, -10238.447265625),
- freespace_revolution = Vector(-10491.779296875, -10135.422851563, -6190.0556640625),
- gm_construct_flatgrass_v6 = Vector(-12550.212890625, -12532.907226563, 0.19838905334473)
- }
- if SERVER then
- local Decoration = {
- Present_1 = {
- Model = "models/effects/bday_gib01.mdl",
- Pos = Vector( 30, -30, 20 ),
- Ang = Angle( 25, -35, 0 )
- },
- Present_2 = {
- Model = "models/effects/bday_gib04.mdl",
- Pos = Vector( 60, -47, 2 ),
- Ang = Angle( 0, 0, 0 )
- },
- Present_3 = {
- Model = "models/props_lab/citizenradio.mdl",
- Pos = Vector( 20, -70, -1 ),
- Ang = Angle( 0, -66, 0 )
- }
- }
- function ENT:Initialize()
- self:SetModel( "models/props_foliage/tree_pine_large.mdl" )
- self:PhysicsInit( SOLID_VPHYSICS )
- self:SetSolid( SOLID_VPHYSICS )
- --self:DrawShadow( true )
- --self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
- self:PhysWake()
- self:GetPhysicsObject():EnableMotion( false )
- for _, v in pairs( Decoration ) do
- local Dec = ents.Create( "prop_physics" )
- Dec:SetModel( v.Model )
- local WPos = LocalToWorld( v.Pos, v.Ang, self:GetPos(), self:GetAngles() )
- Dec:SetPos( WPos )
- Dec:SetAngles( v.Ang )
- Dec:Spawn()
- Dec:GetPhysicsObject():EnableMotion( false )
- Dec:SetParent( self )
- Dec:SetSolid( SOLID_VPHYSICS )
- end
- self:EmitSound( "hayashigs/christmas/01.mp3", 80, 100 )
- end
- local function Spawn()
- for _, v in pairs( ents.FindByClass( ENT.ClassName ) ) do
- v:Remove()
- end
- if Maps[game.GetMap()] then
- local ENT = ents.Create( ENT.ClassName )
- ENT:SetPos( Maps[game.GetMap()] )
- ENT:SetAngles( Angle( 0, 0, 0 ) )
- ENT:Spawn()
- end
- end
- timer.Create( "hihihi", 3, 1, Spawn )
- end
- if CLIENT then
- local mat = Material( "particle/fire" )
- local pos = Vector(180,25,115)
- local wpos, t -- anti gc?
- local render = render
- function ENT:Initialize()
- util.PrecacheSound( "hayashigs/christmas/01.mp3" )
- end
- local ang_origin = Angle(0,0,0)
- function ENT:Draw()
- self:DrawModel()
- render.SetMaterial( mat )
- if not self.data then
- self.data = {}
- for i = 1, 100 do
- local pi = (i/100)*math.pi
- local revi = (-i + 100) * 1.5
- local offset = Vector(0,0,100)
- offset = offset + self:GetRight() * math.sin(pi*9) * revi
- offset = offset + self:GetForward() * math.cos(pi*9) * revi
- offset = offset + self:GetUp() * i * 6.5
- local randsize = math.random() * 50
- local randpos = VectorRand() * 15
- table.insert(self.data,
- {
- lpos = offset + randpos,
- sizex = revi/2 + randsize,
- sizey = revi/2 + randsize,
- color1 = HSVToColor((i/25)*300, 1, 1),
- color2 = HSVToColor((i/100)*100+130, 1, 1),
- }
- )
- end
- else
- t = RealTime()
- for _, params in pairs(self.data) do
- wpos = LocalToWorld(params.lpos, ang_origin, self:GetPos(), self:GetAngles())
- render.DrawSprite(wpos, params.sizex, params.sizey, t%2 > 1 and params.color1 or params.color2)
- end
- end
- end
- end
- scripted_ents.Register( ENT, ENT.ClassName, true )
Advertisement
Add Comment
Please, Sign In to add comment