Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hook.Add("EmitSoundWave", 1, function(ent)
- local i = 1
- local id = "particle_test" .. ent:EntIndex()
- local emitter = ParticleEmitter(ent:GetPos())
- local function Think()
- if i < 0 or not ent:IsValid() then hook.Remove("Think", id) return end
- local pos = ent:NearestPoint(ent:GetPos() - ent:GetVelocity())
- for i = 1, 50 do
- local particle = emitter:Add("sprites/heatwave", pos)
- -- movement
- particle:SetVelocity(VectorRand() * 1000)
- particle:SetAirResistance(0)
- -- appearance
- particle:SetColor(255, 255, 255)
- particle:SetStartAlpha(255)
- particle:SetEndAlpha(0)
- particle:SetStartSize(ent:BoundingRadius())
- particle:SetEndSize(0)
- particle:SetDieTime(math.random() * 0.3)
- end
- i = i - FrameTime()
- end
- hook.Add("Think", id, Think)
- end)
- sonic_boom_backup=sonic_boom_backup or backup or physenv.GetPerformanceSettings()
- local settings={}
- settings.MaxVelocity=50000
- settings.MaxAngularVelocity=50000
- physenv.SetPerformanceSettings(settings)
- local WAVE_CONSTANT=0.001
- --size in newtons
- function EmitSoundWave(b)
- hook.Run("EmitSoundWave",b)
- local speed=((b:GetVelocity():Length()*3600*0.0000254*0.75)/3600)/1000
- local pos=b:GetPos()
- local pitch=0
- local v = LocalPlayer()
- pitch=255/((speed*(v:GetPos():Distance(pos)*0.01905))/WAVE_CONSTANT)
- if pitch<255 and pitch>0 then
- if v:GetPos():Distance(pos)>512 then
- if math.random(1,2)==1 then
- sound.Play('/ambient/weather/thunder4.wav',pos,0,pitch)
- else
- sound.Play('/ambient/weather/thunder3.wav',pos,0,pitch)
- end
- sound.Play('/fireworks/firework_explosion_3.wav',pos,0,pitch)
- sound.Play('/ambient/arrowlight.wav',pos,0,pitch)
- else
- sound.Play('/ambient/machines/floodgate_stop1',pos,0,128)
- end
- end
- end
- timer.Create('DSPtest',0.25,0,function()
- for k,v in pairs(ents.GetAll()) do
- if ((v:GetVelocity():Length()*3600*0.01905)/1000)>100 and v:IsPlayer()==false then
- if v.sonicboom==nil then
- v.sonicboom=true
- EmitSoundWave(v)
- end
- else
- v.sonicboom=nil
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement