Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ENT={}
- ENT.Type = "anim"
- ENT.Base = "base_anim"
- ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
- if SERVER then
- function ENT:Initialize()
- self:SetMoveType( 0 )
- self:DrawShadow( false )
- self:SetModel( "models/dav0r/hoverball.mdl" )
- self:PhysicsInitSphere(260)
- -- self:PhysicsInit(SOLID_VPHYSICS)
- self:SetMoveType(MOVETYPE_VPHYSICS)
- self:SetSolid(SOLID_VPHYSICS)
- self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- self:GetPhysicsObject():EnableMotion(false)
- -- self:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
- self:SetPos(ms.mapdata.coreeffect)
- self:SetTrigger(true)
- end
- function ENT:OnRemove()
- print("Black hole removed",self)
- end
- local Whitelist={
- ["prop_physics"]=true,
- }
- function ENT:StartTouch( ent )
- if not Whitelist[ent:GetClass()] then return end
- print(self,"disintegrate:",ent)
- ent:SetName("dissolvemenao")
- ent:GetPhysicsObject():EnableGravity(false)
- local e=ents.Create'env_entity_dissolver'
- e:SetKeyValue("dissolvetype","3")
- e:SetKeyValue("target","dissolvemenao")
- e:SetKeyValue("dissolvetype","2")
- e:Spawn()
- e:Activate()
- e:Fire("Dissolve","dissolvemenao",0)
- SafeRemoveEntityDelayed(e,1)
- end
- else ------------------------ CLIENT -------------------------
- local tbl=util.KeyValuesToTable[["Aftershock"
- {
- "<dx90"
- {
- "$fallbackmaterial" "Models\Combine_Dropship\dropshipsheet_normal"
- }
- "$colortint" "[0 0 0]"
- "$refractamount" "1"
- "$SilhouetteThickness" "0.7"
- "$SilhouetteColor" "[0 0 0]"
- "$GroundMin" "-1"
- "$GroundMax" "-1"
- "$BlurAmount" "0"
- "$time" "0.0"
- "Proxies"
- {
- "CurrentTime"
- {
- "resultVar" "$time"
- }
- }
- }
- ]]
- INT=INT and INT+1 or 20
- mat=CreateMaterial("testmat"..INT,"Aftershock",tbl)
- local mat2 = Material("models/props_lab/cornerunit_cloud" )
- function ENT:Initialize()
- local vec=Vector(600,600,600)
- self:SetRenderBounds(vec,-vec)
- self.snd=CreateSound(self,"ambient/machines/combine_shield_loop3.wav")
- end
- -- fix bug >:(
- function ENT:OnRemove()
- local vec=Vector(600,600,600)
- self:SetRenderBounds(vec,-vec)
- self.snd:Stop()-- ffuuu
- end
- local fadearea=100
- local endfade=900
- local pi=math.pi
- function ENT:GetMotionBlurValues( x, y, fwd, spin )
- local EntPos = self:GetPos()
- a=((EyePos() - EntPos ):GetNormalized():DotProduct( EyeAngles():Forward()*-1 ))
- local fwd=a and a > 0.85 and a-0.85 or 0
- local distance=EyePos():Distance(EntPos)
- if fwd and fwd > 0 and distance<=endfade then
- local distfactor = distance - endfade+fadearea
- distfactor=1-(distfactor/fadearea)
- distfactor=distfactor>1 and 1 or distfactor<0 and 0 or distfactor
- local final=fwd*distfactor
- -- print("Blur:",final)
- return 0,0,final*(0.9+0.1*(math.sin(CurTime()*2))),final*0.4
- end
- end
- ENT.losethink=false
- ENT.lostthink=true -- now we can find it
- function ENT.Think(s)
- if s.losethink and not s.lostthink then
- s.lostthink=true
- --print"lost think"
- hook.Remove('GetMotionBlurValues',"CoreMotBlur")
- if s.snd then
- s.snd:FadeOut(1)
- end
- s.Think=nil
- elseif s.lostthink and not s.losethink then
- hook.Add('GetMotionBlurValues',"CoreMotBlur",function() -- yeah, just one core, poor us!
- if not IsValid(s) then hook.Remove('GetMotionBlurValues',"CoreMotBlur") end
- return s:GetMotionBlurValues( x, y, fwd, spin )
- end)
- if s.snd then
- s.snd:Play()
- end
- --print"gained think"
- s.lostthink=false
- end
- s.losethink=true
- end
- ENT._Think=ENT.Think
- local size=Vector(4,4,4)
- local lasttime=RealTime()
- local target=10
- local last=10
- local asd=false
- function ENT.Draw(s)
- -- Think hack
- s.losethink=false
- s.Think=s._Think
- -- Switch scale
- if lasttime + 4 < RealTime() then
- lasttime = RealTime()
- last=target
- asd=!asd
- target=math.Rand(10,17)
- end
- -- math
- local frac = ( RealTime()- lasttime )/0.4
- frac = frac > 1 and 1 or frac
- local scale = Lerp( frac, last, target )
- -- it's aliiive!
- scale=scale+math.sin(RealTime()*2)*0.3
- -- Set it up!
- SetMaterialOverride(mat)
- s:SetModelScale(size*scale)
- s:DrawModel()
- s:SetModelScale(size*scale*0.99)
- s:DrawModel()
- SetMaterialOverride(mat)
- s:SetModelScale(size*scale*0.98)
- s:DrawModel()
- SetMaterialOverride( 0 )
- -- Dynalight!
- local id = s:EntIndex()+(asd and 4096 or 0) -- okay i'm lazy :p
- local dlight = DynamicLight( id )
- if dlight then
- dlight.Pos = s:GetPos()
- dlight.r = 10
- dlight.g = 20
- dlight.b = 200
- dlight.Brightness = 10
- dlight.Size = 900
- dlight.Decay = 256
- dlight.DieTime = CurTime() + 1
- dlight.Style = 0
- end
- end
- end
- scripted_ents.Register(ENT, "lua_core_effect", true)
- -- INIT
- if SERVER then
- timer.Simple(2,function()
- if IsValid(a) then a:Remove() end
- a=ents.Create'lua_core_effect'
- a:SetPos(ms.mapdata.coreeffect)
- a:Spawn()
- a:Activate()
- end)
- else
- end
Advertisement
Add Comment
Please, Sign In to add comment