first commit

master
cheetah 2 years ago
commit 5fa10eb47e

@ -0,0 +1,778 @@

Ambience = Ambience or {}
Ambience.ActiveSounds = Ambience.ActiveSounds or {}
Ambience.Running = false
Ambience.AmbientData = {}
Ambience.StreetData = {}
Ambience.StreetLexika = {}
Ambience.ScreenVehicleData = {}
Ambience.SoundData = {
["*"] = {
"rustsurvival/ambient/a_interior_generic_loop.wav"
}
}
Ambience.Music = {
Wanted = {
"music/hl2_song3.mp3",
"music/hl2_song4.mp3",
"music/hl2_song6.mp3",
"music/hl2_song29.mp3",
"music/hl2_song16.mp3",
"music/hl1_song10.mp3",
"music/hl2_song20_submix0.mp3",
},
Normal = {
"music/hl2_song31.mp3",
"music/hl1_song11.mp3",
"music/hl2_song14.mp3",
"music/hl2_song12_long.mp3",
"music/hl1_song25_remix3.mp3",
"music/hl2_song31.mp3",
"music/hl1_song17.mp3",
"music/hl2_song8.mp3",
},
Weird = {
"music/hl2_song13.mp3",
"music/hl2_song17.mp3",
"music/hl2_song30.mp3",
"music/hl1_song15.mp3",
"music/hl2_song32.mp3",
"music/hl2_song33.mp3",
"music/hl2_song19.mp3",
},
}
Ambience.ActiveMusicTheme = 0
Ambience.Fresh = true
Ambience.CurrentRegion = ""
Ambience.CurrentZone = ""
Ambience.RenderedStreetID = -1
Ambience.DownloadCount = 0
Ambience.CurrentStreetID = 0
Ambience.ClosestNodeData = nil
Ambience.ClosestNode = Vector(0,0,0)
Ambience.ClosestNodeDistance = 600000
Ambience.GraphData = {}
Ambience.ScapeData = {}
Ambience.WorldZ = 0
AMBIENCE_PACKET_AMBIENT = 0
AMBIENCE_PACKET_STREET = 1
AMBIENCE_PACKET_LEXIKA = 2
AMBIENCE_PACKET_SVDATA = 3
AMBIENCE_PACKET_SCAPE = 4
AMBIENCE_PACKET_GRAPH = 5
if SERVER then AddCSLuaFile() end
if CLIENT then
local PANEL = {}
function PANEL:Init()
self:SetSize( 24, 24 )
self:NoClipping( true )
self.imgPanel = vgui.Create( "DImage", self );
self.imgPanel:SetImage( "icon16/script.png" );
self.imgPanel:SetSize( 16, 16 )
self.imgPanel:SetPos( 4, 4 )
self.imgPanel:SetAlpha( 30 )
self.BoxW = 0
self.BoxH = 0
end
function PANEL:SetUp( name )
local ext = string.GetExtensionFromFilename( name );
if ( ext == "data" ) then
self.imgPanel:SetImage( "icon16/script.png" );
/*elseif ( ext == "vtf" ) then
self.imgPanel:SetImage( "icon16/palette" );
elseif ( ext == "mdl" ) then
self.imgPanel:SetImage( "icon16/brick_add" );
elseif ( ext == "wav" ) then
self.imgPanel:SetImage( "icon16/sound" );*/
end
self.imgPanel:AlphaTo( 255, 0.2, 0 )
end
function PANEL:Update( f, status, name, size )
self.status = status
self.f = f;
self.size = size
if ( self.name != name ) then
self:SetUp( name )
self.name = name
end
end
function PANEL:Think()
if ( self.Bouncing ) then
local ft = FrameTime() * 20
self.yvel = self.yvel + 2.0 * ft
self.xvel = math.Approach( self.xvel, 0.0, ft * 0.01 )
self.xpos = self.xpos + self.xvel * ft * 3
self.ypos = self.ypos + self.yvel * ft * 3
if ( self.ypos > (ScrH() - 24) ) then
self.ypos = (ScrH() - 24)
self.yvel = self.yvel * -0.6
self.xvel = self.xvel * 0.8
end
self:SetPos( self.xpos, self.ypos )
end
end
function PANEL:Paint()
local r = 255 - 255 * self.f
local g = 255
local b = 255 - 255 * self.f
local a = self.imgPanel:GetAlpha()
if ( self.f == 1.0 && !self.Bouncing ) then
r = 255
g = 55 + math.Rand( 0, 200 )
b = 5
end
if ( self.DownloadFailed ) then
r = 255
g = 50
b = 50
end
draw.RoundedBox( 4, 0, 0, self:GetWide(), self:GetTall(), Color( 20, 20, 20, a * 0.4 ) )
draw.RoundedBox( 4, 1, 1, self:GetWide()-2, self:GetTall()-2, Color( r, g, b, a * 0.7 ) )
// If the file is bigger than 3MB, give us some info.
if ( self.f < 1.0 && self.size > (1024 * 1024 * 3) ) then
self:DrawSizeBox( a )
end
end
function PANEL:DrawSizeBox( a )
local x = (self.BoxW - self:GetWide()) * -0.5
local txt = math.Round( self.f * 100, 2 ) .."% of ".. string.NiceSize( self.size )
self.BoxW, self.BoxH = draw.WordBox( 4, x, self.BoxH * -1.1, txt, "DefaultSmall", Color( 50, 55, 60, a * 0.8 ), Color( 255, 255, 255, a ) )
end
function PANEL:Bounce()
local x, y = self:LocalToScreen( 0, 0 )
self:SetParent( GetHUDPanel() )
self:SetPos( x, y )
self.Bouncing = true
self.xvel = math.random( -12, 12 )
self.yvel = math.random( -20, -10 )
self.xpos = x
self.ypos = y
self.imgPanel:AlphaTo( 0, 1, 1 )
end
function PANEL:Failed()
self.DownloadFailed = true;
end
vgui.Register( "GM12_DContentDownload", PANEL, "DPanel" )
local PANEL = {}
function PANEL:Init()
self:SetSize( 256, 100 )
self:SetPos( 0, ScrH() + 10 )
self:SetZPos( 100 )
end
function PANEL:Think()
self:SetParent(GetHUDPanel())
if ( self.LastActivity && (SysTime() - self.LastActivity) > 2 ) then
self:MoveTo( self.x, ScrH() + 5, 0.5, 0.5 )
self.LastActivity = nil;
self.MaxFileCount = 0
end
for k, v in pairs( Downloads ) do
local x = (self:GetWide() * 0.5) + math.sin( SysTime() + k*-0.43 ) * self:GetWide() * 0.45
local y = (20) + math.cos( SysTime() + k*-0.43 ) * 20 * 0.5
v:SetPos( x-13, y )
v:SetZPos( y )
v.accel = accel;
end
end
function PANEL:OnActivity( dlt )
if ( self.LastActivity == nil ) then
self:MoveTo( self.x, ScrH() - self:GetTall() + 20, 0.1 )
end
self.LastActivity = SysTime()
end
function PANEL:PerformLayout()
self:CenterHorizontal()
end
function PANEL:Add( p )
local x, y = self:GetPos()
local ypos = math.random( 20, 25 )
end
vgui.Register( "GM12_DContentMain", PANEL, "Panel" )
if(Main) then Main:Remove() end
Downloads = {}
local Main = nil
function UpdatePackageDownloadStatus( id, name, f, status, size )
if ( !Main ) then
Main = vgui.Create("GM12_DContentMain")
end
local dl = Downloads[ id ]
if ( dl == nil ) then
dl = vgui.Create( "GM12_DContentDownload", Main )
dl.Velocity = Vector( 0, 0, 0 );
dl:SetAlpha(255)
Downloads[ id ] = dl
Main:Add( dl )
end
dl:Update( f, status, name, size );
if ( status == "success" ) then
dl:Bounce()
Downloads[ id ] = nil
surface.PlaySound( "hl1/fvox/fuzz.wav" )
timer.Simple( 2, function()
dl:Remove()
end )
end
if ( status == "failed" ) then
dl:Failed()
Downloads[ id ] = nil
surface.PlaySound( "hl1/fvox/buzz.wav" )
timer.Simple( 2, function()
dl:Remove()
end )
end
Main:OnActivity( Downloads )
end
/*
Ende Toybox Download Boxen
*/
Ambience.CEnabled = CreateClientConVar( "soundmaster_enabled","1",true,false,"Should the Soundmaster be on?")
cvars.AddChangeCallback("soundmaster_enabled",function(cvar,old,new)
if old == "0" and new == "1" then
Ambience.Fresh = true
end
if old == "1" and new == "0" then
Ambience.Stop()
end
end)
Ambience.CDebugEnabled = CreateClientConVar( "soundmaster_debug_enabled","0",true,false,"Debug Only for Developer Job")
Ambience.splodesprite = Material("sprites/light_glow04")
Ambience.DebugTexture = Material("dev/dev_materialmodify")
function Ambience.ClosestLineIntersection(a,b,p)
local AP = p - a
local AB = b - a
local magnitudeAB = AB:LengthSqr()
local ABAPproduct = AP:Dot(AB)
local distance = ABAPproduct / magnitudeAB
if distance < 0 then
return a, (distance*AB):LengthSqr()
elseif distance > 1 then
return b, (distance*AB):LengthSqr()
else
return a + AB * distance , (distance*AB):LengthSqr()
end
return Vector(0,0,0),23456789
end
function Ambience.IsInRegion(regionRect)
local lp = LocalPlayer():EyePos()
local rs = regionRect.Start
local re = regionRect.End
if lp.x >= re.x and lp.x <= rs.x and
lp.y >= re.y and lp.y <= rs.y and
lp.z >= rs.z and lp.z <= re.z
then
return true
end
return false
end
function Ambience.GetMusic()
if(Ambience.ActiveMusicTheme == 0) then return Ambience.Music.Normal[math.random(0,#Ambience.Music.Normal-1)] end
if(Ambience.ActiveMusicTheme == 1) then return Ambience.Music.Weird[math.random(0,#Ambience.Music.Weird-1)] end
if(Ambience.ActiveMusicTheme == 2) then return Ambience.Music.Wanted[math.random(0,#Ambience.Music.Wanted-1)] end
end
function Ambience.Think()
if Ambience.Fresh == true then
Ambience.Fresh = false
if Ambience.CEnabled:GetBool() == true then
local delayedStart = false
/*if Ambience.ActiveMusic then
Ambience.ActiveMusic:ChangeVolume(0,2)
timer.Simple(2,function()
Ambience.ActiveMusic:Stop()
Ambience.ActiveMusic = nil
end) end*/
if Ambience.ActiveSounds and table.Count(Ambience.ActiveSounds) > 0 then
Ambience.Stop()
delayedStart = true
end
local function timedStart()
if LocalPlayer() and IsValid(LocalPlayer()) then Ambience.Init() end
hook.Add("Initalize","Ambience.Init",Ambience.Init)
net.Receive("MapData.Request",function(len)
Ambience.Init()
end)
end
if delayedStart then timer.Simple(2.3,timedStart) else timedStart() end
end
end
if Ambience.Running == false then return end
Ambience.ClosestNodeDistance = 600000
if Ambience.AmbientData then
local MapData = Ambience.AmbientData
Ambience.ScapeDatas = nil
Ambience.CurrentRegion = ""
Ambience.CurrentZone = -1
for _,regionName in pairs(MapData) do
for __,regionRect in pairs(regionName) do
local xc = (255 / table.Count(regionName)) * __
local c = Color(255*xc,255 - (255*xc),0,20)
if Ambience.IsInRegion(regionRect) then
Ambience.CurrentRegion = _
Ambience.CurrentZone = __
end
end
end
if Ambience.AmbientData[Ambience.CurrentRegion] and Ambience.AmbientData[Ambience.CurrentRegion][Ambience.CurrentZone] then
Ambience.ScapeDatas = Ambience.AmbientData[Ambience.CurrentRegion][Ambience.CurrentZone].Scape
end
for scapeName,snd in pairs(Ambience.ActiveSounds) do
if not Ambience.CheckConditions(scapeName) or not Ambience.ScapeDatas or not Ambience.ScapeDatas[scapeName] then
Ambience.FadeOut(scapeName)
end
end
if Ambience.ScapeDatas then
for _,scapeName in pairs(Ambience.ScapeDatas) do
if Ambience.CheckConditions(scapeName) then
Ambience.FadeIn(scapeName)
end
end
end
--Ambience.SetStatus("Region="..Ambience.CurrentRegion,1)
--Ambience.SetStatus("Zone="..Ambience.CurrentZone,3)
end
if Ambience.StreetData and LocalPlayer():InVehicle() then
local lpPos = LocalPlayer():GetPos()
local traceRes = util.TraceLine({
start = lpPos,
endpos = lpPos - Vector(0,0,2000),
mask = MASK_SOLID_BRUSHONLY,
filter = LocalPlayer()
})
Ambience.WorldZ = traceRes.Hit and traceRes.HitPos.z or Ambience.WorldZ
local StreetData = Ambience.StreetData
local StreetLexika = Ambience.StreetLexika
local lpp = Vector(lpPos.x,lpPos.y,0)
for _,node in pairs(StreetData) do
local z = LocalPlayer():GetPos().z
local intersects, distance = Ambience.ClosestLineIntersection(node.Start,node.End,lpp)
if Vector(node.Start.x,node.Start.y,0):Distance(lpp) > 512 and Vector(node.End.x,node.End.y,0):Distance(lpp) > 512 and intersects:Distance(lpp) > 512 then continue end
local la1 = node.Start:Distance(lpp) < node.End:Distance(lpp) and node.Start or node.End
local la2 = node.Start:Distance(lpp) > node.End:Distance(lpp) and node.Start or node.End
la1 = LerpVector(0.5,la1,la2)
local intersects, distance = Ambience.ClosestLineIntersection(la1,la2,lpp)
local distA = Ambience.ClosestNode:Distance(intersects)
local distB = intersects:Distance(lpp)
--MsgN(_ .. "=DistA="..math.Round(distA).." DistB="..math.Round(distB))
if Ambience.ClosestNode and distA > distB and Ambience.CurrentStreetID != node.StreetID then
--MsgN(distA.." < ".. distB .. " changing to ".. (Ambience.StreetLexika[node.StreetID] or ""))
Ambience.ClosestNodeData = node
Ambience.ClosestNode = intersects
Ambience.ClosestNodeDistance = distance
Ambience.CurrentStreetID = node.StreetID
end
end
if Ambience.ClosestNodeData then
--PrintTable(Ambience.ClosestNodeData.ConnectedWith or {})
end
end
if Ambience.ActiveSounds then
local u = 0
for i,k in pairs(Ambience.ActiveSounds) do
if k.fade then
u=u+1
if k.targetFade > 0 then
if not k.Sound then
--MsgN("Creating "..i)
Ambience.CreateSound(i,k)
if Ambience.ActiveSounds[i] == nil then
continue
end
end
if k.Sound and k.Sound:IsPlaying() == false then
k.Sound:ChangeVolume(0,0)
k.Sound:Play()
--MsgN("Playing "..i)
end
else
if k.Sound and k.Sound:IsPlaying() == true then
k.Sound:Stop()
k.Sound = nil
--MsgN("Destroying "..i)
end
end
--Ambience.SetStatus("Vol["..math.Round(k.targetFade,2).."] = "..i,u)
if k.Sound then
k.Sound:ChangeVolume(k.targetFade*(k.volume or 1)*(LocalPlayer():InVehicle() and 0.5 or 1),0)
end
Ambience.ActiveSounds[i].targetFade = Lerp(0.002*FrameTime(),Ambience.ActiveSounds[i].fade,Ambience.ActiveSounds[i].targetFade)
end
end
end
/*if not Ambience.ActiveMusic then
local pth = Ambience.GetMusic()
MsgN("playing Music "..pth)
Ambience.ActiveMusic = CreateSound(game.GetWorld(),pth)
Ambience.ActiveMusic:SetSoundLevel(0)
Ambience.ActiveMusic:ChangeVolume(0,0)
Ambience.ActiveMusic:Play()
Ambience.ActiveMusic:ChangeVolume(0.2,5)
end
if Ambience.ActiveMusic and Ambience.ActiveMusic:IsPlaying() == false then
Ambience.ActiveMusic = nil
end*/
end
function Ambience.DebugDeep(status,scape)
Ambience.ActiveSounds[scape].debug = status
end
function Ambience.CheckConditions(scapeName)
if not Ambience.ActiveSounds[scapeName] then MsgN(scapeName.." doesnt exists, reutrning false") return false end
if Ambience.ActiveSounds[scapeName].cond == true then return true end
local weather = SW.GetCurrentWeather() and (SW.GetCurrentWeather().ID or "none") or "none"
local catastrophicWeather = (weather == "rain" or weather == "storm" or weather == "blizzard")
local rainyWeather = (weather == "rain" or weather == "storm")
for i,k in pairs(Ambience.ActiveSounds[scapeName].cond) do
if k == "SW.Day" and (SW.Time > 20.5 or SW.Time < 4) then Ambience.DebugDeep('SW.Day',scapeName) return false end
if k == "SW.Night" and (SW.Time < 20 and SW.Time > 4.5) then Ambience.DebugDeep('SW.Night',scapeName) return false end
if k == "SW.DryWeather" and catastrophicWeather then Ambience.DebugDeep('SW.DryWeather',scapeName) return false end
if k == "SW.InVehicle" and not LocalPlayer():InVehicle() then Ambience.DebugDeep('SW.InVehicle',scapeName) return false end
if k == "!SW.InVehicle" and LocalPlayer():InVehicle() then Ambience.DebugDeep('!SW.InVehicle',scapeName) return false end
if k == "SW.RainWeather" and not rainyWeather then Ambience.DebugDeep('SW.RainWeather',scapeName) return false end
if k == "SW.WindWeather" and not catastrophicWeather then Ambience.DebugDeep('SW.WindWeather',scapeName) return false end
end
Ambience.DebugDeep("True",scapeName)
return true
end
function Ambience.Node(_,node,ps)
if not LocalPlayer():InVehicle() then return end
local lpPos = LocalPlayer():GetVehicle():GetPos()
local rotPl = LocalPlayer():GetVehicle():GetAngles().yaw
local rr = 90+45
local rot = Angle(0,EyeAngles().yaw-90,90)
local pos = Vector(ps.x,ps.y,Ambience.WorldZ)
rot:SnapTo("y",30)
--if Ambience.RenderedStreetID[node.StreetID] then return false end
--Ambience.RenderedStreetID[node.StreetID] = true
local cc = Vector(ps.x,ps.y,0):Distance(Vector(lpPos.x,lpPos.y,0)) <= (512+256)
--cam.Start3D2D(pos,rot,1)
-- draw.SimpleText(Ambience.StreetLexika[node.StreetID].."[".._.."]","DermaLarge",0,-60,MF4Config.MainColor,0,1)
--cam.End3D2D()
end
function Ambience.DrawGPSInt(w,h)
surface.SetDrawColor(80,80,80)
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(255,0,0)
surface.DrawLine(0,20,50,80)
if Ambience.StreetData then
local txt = Ambience.StreetLexika[Ambience.CurrentStreetID] or "-"
surface.SetFont("matf4_job")
local tw,th = surface.GetTextSize(txt)
draw.SimpleText(txt,"matf4_job",w/2,h-th*2,color_white,1,1)
end
end
Ambience.GPSRenderTarget = nil
Ambience.GPSRenderTargetMat = nil
function Ambience.DrawGPS(w,h)
Ambience.GPSRenderTarget = GetRenderTarget("gps",w,h,false)
local Scrw,Scrh = ScrW(),ScrH()
render.PushRenderTarget(Ambience.GPSRenderTarget)
cam.Start2D()
--render.OverrideAlphaWriteEnable(true, true)
Ambience.DrawGPSInt(w,h)
cam.End2D()
render.PopRenderTarget()
if not Ambience.GPSRenderTargetMat then
Ambience.GPSRenderTargetMat = CreateMaterial("gpsrt","UnlitGeneric",{
["$basetexture"] = Ambience.GPSRenderTarget
})
end
if Ambience.GPSRenderTargetMat then
surface.SetDrawColor(255,255,255)
surface.SetMaterial(Ambience.GPSRenderTargetMat)
surface.DrawTexturedRect(0,0,w,h)
else
surface.SetDrawColor(255,0,0)
surface.DrawRect(0,0,w,h)
end
end
function Ambience.Debug(hud)
if Ambience.Running == false then return end
if LocalPlayer() and LocalPlayer():InVehicle() and Ambience.ScreenVehicleData and Ambience.ScreenVehicleData[LocalPlayer():GetVehicle():GetModel()] then
local veh = LocalPlayer():GetVehicle()
local data = Ambience.ScreenVehicleData[veh:GetModel()]
--MsgN(veh:WorldToLocal(LocalPlayer():GetEyeTrace().HitPos))
--MsgN(veh:WorldToLocalAngles((LocalPlayer():EyePos() - LocalPlayer():GetEyeTrace().HitPos):Angle()))
cam.Start3D2D(veh:LocalToWorld(data.lp),veh:LocalToWorldAngles(data.la),0.025)
Ambience.DrawGPS(data.w,data.h)
cam.End3D2D()
--MsgN(LocalPlayer():GetVehicle():GetModel())
end
if Ambience.StreetData and not hud and LocalPlayer():InVehicle() then
--render.SetColorMaterial()
local StreetData = Ambience.StreetData
local StreetLexika = Ambience.StreetLexika
local lpPos = LocalPlayer():GetPos()
local z = LocalPlayer():GetPos().z
local rotPl = LocalPlayer():GetAngles().yaw
Ambience.RenderedStreetID = {}
for _,node in pairs(StreetData) do
if Vector(node.Start.x,node.Start.y,drawZS):Distance(LocalPlayer():GetPos()) > 4000 and Vector(node.End.x,node.End.y,drawZS):Distance(LocalPlayer():GetPos()) > 4000 then continue end
if Vector(node.Start.x,node.Start.y,0):Distance(Vector(lpPos.x,lpPos.y,0)) <= 4000 then
Ambience.Node(_,node,Ambience.ClosestLineIntersection(node.Start,node.End,Vector(lpPos.x,lpPos.y,0)))
--render.DrawLine(Vector(node.Start.x,node.Start.y,Ambience.WorldZ),Vector(node.End.x,node.End.y,Ambience.WorldZ),Ambience.CurrentStreetID == node.StreetID and Color(200,0,0) or Color(0,255,255),false)
end
end
end
if (LocalPlayer():Team() == TEAM_DEV or GetHostName() == "Garry's Mod") and Ambience.CDebugEnabled:GetInt() > 0 then // or LocalPlayer():SteamID() == "STEAM_0:1:46594887" then
if table.Count(Ambience.ActiveSounds) > 0 then
surface.SetFont("TargetID")
local _ignore,fontH = surface.GetTextSize("0")
local extraLines = 1 + (Ambience.ScapeDatas and (1 + table.Count(Ambience.ScapeDatas)) or 0)
local w,h,y = 420,fontH*table.Count(Ambience.ActiveSounds) + fontH*extraLines,0
local x = ScrW()-w
surface.SetDrawColor(80,80,80,120)
surface.DrawRect(x,y,w,h)
surface.SetDrawColor(255,255,255,255)
local function txt(x,y,str)
surface.SetTextPos(x,y*fontH)
surface.DrawText(type(str) == "string" and str or tostring(str))
end
local yy = 1
surface.SetTextColor(255,255,255,255)
txt(x+0,0,"Name:")
txt(x+190,0,"F|T:")
txt(x+220,0,"Cond:")
txt(x+270,0,"DCond:")
for scapeName,scapeData in pairs(Ambience.ActiveSounds) do
if scapeData.Sound then surface.SetTextColor(0,255,0,255) else surface.SetTextColor(255,0,0,255) end
txt(x,yy,scapeName)
txt(x + 190,yy,scapeData.fade or 0)
surface.SetTextColor(91,113,255,255)
txt(x + 205,yy,scapeData.targetFade or 0)
local condRes = Ambience.CheckConditions(scapeName)
if condRes then surface.SetTextColor(0,255,0,255) else surface.SetTextColor(255,0,0,255) end
txt(x + 220,yy,condRes and "True" or "False")
if scapeData.debug then
surface.SetTextColor(91,113,255,255)
txt(x + 270,yy,tostring(scapeData.debug))
end
yy = yy + 1
end
txt(x+0,yy,"Current Scapes: ")
yy = yy + 1
if Ambience.ScapeDatas then
for _,NME in pairs(Ambience.ScapeDatas) do
txt(x+0,yy,NME)
yy = yy + 1
end
end
end
if Ambience.AmbientData and 3 > 2 then
if not hud then
render.SetColorMaterial()
render.OverrideDepthEnable(true,true)
render.CullMode(MATERIAL_CULLMODE_CW)
render.SetColorMaterial()
render.SetLightingMode(2)
render.SetBlend(1)
end
local MapData = Ambience.AmbientData
for _,regionName in pairs(MapData) do
for __,regionRect in pairs(regionName) do
if not hud and Ambience.CDebugEnabled:GetInt() == 2 then
local xc = (255 / table.Count(regionName)) * __
local c = Color(255*xc,255 - (255*xc),0,255)
if not Ambience.IsInRegion(regionRect) then
Ambience.CurrentRegion = _
Ambience.CurrentZone = __
render.DrawBox(regionRect.Start,Angle(0,0,0),Vector(0,0,0),Vector(regionRect.End.x - regionRect.Start.x,regionRect.End.y - regionRect.Start.y,regionRect.End.z - regionRect.Start.z),c)
render.CullMode(MATERIAL_CULLMODE_CW)
render.DrawBox(regionRect.Start,Angle(0,0,0),Vector(0,0,0),Vector(regionRect.End.x - regionRect.Start.x,regionRect.End.y - regionRect.Start.y,regionRect.End.z - regionRect.Start.z),c)
render.DrawLine(regionRect.Start,Vector(regionRect.Start.x,regionRect.Start.y,regionRect.End.z),Color(255,255,0))
render.DrawLine(regionRect.End,Vector(regionRect.End.x,regionRect.End.y,regionRect.Start.z),Color(0,255,255))
end
end
if hud and Ambience.IsInRegion(regionRect) then
draw.SimpleText("REGION=".._.."/"..__,"DermaLarge",ScrW()/2,ScrH()/2 + 80,color_white,1,1)
break
end
end
end
if not hud then
render.CullMode(MATERIAL_CULLMODE_CCW)
render.OverrideDepthEnable(false,false)
render.SetLightingMode(0)
render.SetBlend(1)
end
end
end
end
function Ambience.SetStatusLoading(txt)
MsgN("[Clean Ambience]"..txt)
notification.AddProgress("Ambience.SetStatusLoading","[Clean Ambience]"..txt)
end
function Ambience.SetStatus(txt,u)
--MsgN("[Ambient]"..txt)
notification.AddProgress("Ambience.SetStatusLoading"..tostring(u or ""),"[Clean Ambience]"..txt)
--GAMEMODE:AddNotify(txt,NOTIFY_GENERIC,5)
end
function Ambience.Stop()
Ambience.DownloadCount = 0
Ambience.Running = false
Ambience.SetStatus("Gestoppt")
for i,k in pairs(Ambience.ActiveSounds) do
if IsValid(k.Sound) then k.Sound:Stop() end
end
//if IsValid(Ambience.ActiveMusic) then Ambience.ActiveMusic:Stop() end
timer.Simple(10,function()
if not Ambience.Running then
notification.Kill("Ambience.SetStatusLoading")
end
end)
end
function Ambience.Init()
Ambience.DownloadCount = 0
for i=0,10 do notification.Kill("Ambience.SetStatusLoading"..tostring(i)) end
if Ambience.LastInit and Ambience.LastInit + 1 >= CurTime() then return end
Ambience.LastInit = CurTime()
Ambience.GraphData = {}
Ambience.AmbientData = {}
Ambience.StreetData = {}
Ambience.StreetLexika = {}
net.Receive("MapData.MapPacketHeader",function(len)
Ambience.DownloadCount = net.ReadInt(32)
for i=1,Ambience.DownloadCount do
UpdatePackageDownloadStatus(i,"", 0,"",1)
end
end)
net.Receive("MapData.MapPacket",function(len)
local packetsRemain = net.ReadInt(32)
UpdatePackageDownloadStatus(packetsRemain,"", 1,"success",1)
Ambience.SetStatusLoading("Lade Daten ["..packetsRemain.." verbleibend]")
local packetType = net.ReadInt(32)
local packetData = net.ReadTable()
if packetType == AMBIENCE_PACKET_AMBIENT then table.Merge(Ambience.AmbientData,packetData) end
if packetType == AMBIENCE_PACKET_STREET then table.Merge(Ambience.StreetData,packetData) end
if packetType == AMBIENCE_PACKET_LEXIKA then table.Merge(Ambience.StreetLexika,packetData) end
if packetType == AMBIENCE_PACKET_SVDATA then table.Merge(Ambience.ScreenVehicleData,packetData) end
if packetType == AMBIENCE_PACKET_SCAPE then table.Merge(Ambience.ScapeData,packetData) end
if packetType == AMBIENCE_PACKET_GRAPH then table.Merge(Ambience.GraphData,packetData) end
if packetsRemain == 0 then
Ambience.SetStatus("Starte Client")
notification.Kill("Ambience.SetStatusLoading")
timer.Simple(1,function()
Ambience.Start()
notification.AddLegacy("[Clean Ambience]".."Aktiv",NOTIFY_HINT,2)
end)
end
end)
net.Start("MapData.Request")
net.SendToServer()
Ambience.SetStatus("Initialisiere")
end
function Ambience.GetSoundIndex(index)
return index
end
function Ambience.FadeIn(id)
Ambience.ActiveSounds[Ambience.GetSoundIndex(id)].fade = 1
end
function Ambience.FadeOut(id)
Ambience.ActiveSounds[Ambience.GetSoundIndex(id)].fade = 0
end
function Ambience.CreateSound(index,data)
local snd = CreateSound(game.GetWorld(),type(data.path) == "string" and data.path or table.Random(data.path))
MsgN("Spawning Sound "..index)
snd:SetSoundLevel(0)
snd:ChangeVolume(0,0)
Ambience.ActiveSounds[Ambience.GetSoundIndex(index)] = {path=data.path,Sound=snd,fade=data.fade or 0,targetFade=data.targetFade or 0,volume=data.volume or 1,cond = data.cond or true}
end
function Ambience.Start()
//Ambience.ActiveMusic = nil
Ambience.Running = true
RunConsoleCommand("play","garrysmod/save_load4.wav")
notification.Kill("Ambience.SetStatusLoading")
for i,k in pairs(Ambience.ScapeData) do
Ambience.ActiveSounds[Ambience.GetSoundIndex(i)] = {path=k.path,Sound=nil,fade=0,targetFade=0,volume=k.volume or 1,cond = k.cond or true}
end
end
hook.Add("Think","Ambience.Think",Ambience.Think)
hook.Add("PostDrawOpaqueRenderables","Ambience.Debug",function() Ambience.Debug(false) end)
hook.Add("HUDPaint","Ambience.Debug",function() Ambience.Debug(true) end)
hook.Add("Initalize","Ambience.Debug",function() Ambience.Init() end)
end

@ -0,0 +1,15 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 4thebadwolfsky
All Rights Reserved
Website: derauto.de
-----------------------------------------------------------*/
AddCSLuaFile()
SoundMaster = SoundMaster or {}
function SoundMaster.PlayerMoveIn()
LocalPlayer():EmitSound( "soundmaster/localplayer_ac/" .. table.Random({"0x130015D4","0x1A68325D"}) .. ".mp3")
end
function SoundMaster.Heartbeat()
LocalPlayer():EmitSound( "soundmaster/localplayer_ac/0x0D6E1C39.mp3")
end

@ -0,0 +1,343 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 Jonas Hogeback / UltimateRP
All Rights Reserved
Website: UltimateRP.net
-----------------------------------------------------------*/
-------------------------------------------------------------------------
--AC-Container
-------------------------------------------------------------------------
resource.AddFile("sound/soundmaster/ambient_ac/0xFAF134.wav")
resource.AddFile("sound/soundmaster/ambient_ac/0xFAF135.wav")
resource.AddFile("sound/soundmaster/ambient_ac/0xFAF136.wav")
resource.AddFile("sound/soundmaster/camera_ac/0x0C4E9EBF.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x1B33E508.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x1F6744EF.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x06DAFC36.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x08D657CA.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x11AD297B.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x098D81BF.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x1114D0AA.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x1544F0A7.mp3")
resource.AddFile("sound/soundmaster/camera_ac/0x18809F85.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x00CED401.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x0DF65CA9.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x0F481DDD.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x1AF0B69D.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x1F56FF6A.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x03E4DA2C.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x15E86B1D.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x18B930BF.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x0450C95F.mp3")
resource.AddFile("sound/soundmaster/carcrash_ac/0x16387ED3.mp3")
resource.AddFile("sound/soundmaster/carexplosion_ac/0x0FEDCD9C.mp3")
resource.AddFile("sound/soundmaster/carexplosion_ac/0x1D0B27DF.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x00B2F6BA.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x00B6707B.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x01B1AF7D.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x01C13D68.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x01C6ACF5.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x02ECC258.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x03B0EE67.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x09189558.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0A2FD124.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0B35D266.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0B3B27C4.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0C253668.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0C2F3057.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0C33C56D.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0C3B23C8.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0C5AF52C.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D075B8C.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D13ED57.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D1921FC.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D230E1D.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D2DCE33.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0D55C45A.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0DB1E637.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0DB666FB.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0DBE55BA.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0DD6D19B.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0E1C2849.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0E6FDE7D.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0EBD19F8.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0EC309A0.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x0EC72038.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1A26BF1E.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1AF1A2E8.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1AF80920.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1B61EA9A.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1B822B29.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1BF66406.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1C9FD0EC.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1C9FE55F.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1E45B1E0.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1E5C624F.mp3")
resource.AddFile("sound/soundmaster/collision_ac/0x1E9BFFE1.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x0A5C9984.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x0D62B5C8.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x0F53B289.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x0FB8E45F.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x1D58BD31.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x1E26013A.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x1E730570.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x1F3BC0B9.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x03B889B2.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x10F96434.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x019BC825.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x123E16B5.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x184F997B.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x1540AF70.mp3")
resource.AddFile("sound/soundmaster/cash_register_ac/0x066777A9.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x0FD726C5.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x0FF04137.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x1CAAEBB7.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x1EBDAB40.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x089D93B2.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x176EA717.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x181D66EA.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x1038E2C4.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086B8.mp3")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086B9.wav")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086BA.wav")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086BB.wav")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086BC.wav")
resource.AddFile("sound/soundmaster/explosion_ac/0x081086BD.wav")
resource.AddFile("sound/soundmaster/frontend_ac/0x00CA97EA.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0AABA0E8.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0B37A9F9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0B413B72.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0C16D0A2.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0C44A41E.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0D7E3CB9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0D91BBC2.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0D116469.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0D605633.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0DEFB827.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0E7FD3A9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0E60F7B2.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0E80F359.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0E786491.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0EFF1288.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0F5EE557.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0FB135B7.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0FE5FB3B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1A21FC9A.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1BA0D2AA.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1D8FAE56.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1D00809C.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1D745657.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1DCAE39B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1E941898.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1F7C4E84.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1F751A54.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1F577720.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1FADC6FF.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1FC9FEEF.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x02B6FC17.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x04E96C50.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x04F682A9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x05CA67D5.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x05F84F3F.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x006B8824.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x10E0BD2B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x11C3A2EB.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x11E10568.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x11F3FA3A.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x13A0FD34.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x14BEEADC.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x14DC0C22.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x14FC8069.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x15CC4ECC.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x18F84D60.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x19A90AD1.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x19BCC627.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x023D93B4.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x025EE67B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x033D89C9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x035D1645.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x042C9EAD.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x042FBD33.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0057EED0.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x067C3776.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x094B1DA0.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x100C996A.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x103A752D.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x114D1C55.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x115A0619.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x119BA8D7.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x135A82A2.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x146B3B83.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x152C8678.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x157FC6E1.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0189DF00.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0224A6B9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0240A96E.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0256FE1D.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0486E2DA.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x0826AC8E.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1018C2CC.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1857EC2E.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x17730A4F.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x074729F7.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1028679F.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1107976B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x1200589B.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/0x06264583.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_1.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_2.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_3.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_4.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_5.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_6.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_7.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_8.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_9.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_10.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_11.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_12.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_13.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_14.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_15.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/BLIP_16.mp3")
resource.AddFile("sound/soundmaster/frontend_ac/RADIO_STATIC_LOOP.mp3")
resource.AddFile("sound/soundmaster/handcuffs_ac/0x03B5745A.mp3")
resource.AddFile("sound/soundmaster/handcuffs_ac/0x15EEA224.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x0D6E1C39.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x1A68325D.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x06D84612.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x073E8A8C.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x0972C598.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x130015D4.mp3")
resource.AddFile("sound/soundmaster/localplayer_ac/0x131731C0.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF124.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF125.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF126.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF127.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF128.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF129.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF130.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF131.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF132.mp3")
resource.AddFile("sound/soundmaster/player_ac/0xFAF133.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0E6.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0E7.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0E8.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0E9.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0E0.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0EA.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0EB.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0EC.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0ED.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF0EE.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF101.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF102.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF103.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF104.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF105.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF106.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF107.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF108.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF109.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF10A.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF10B.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF10C.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF10D.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF10E.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF110.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF111.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF112.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF113.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF114.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF115.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF116.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF117.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF118.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF119.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF120.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF121.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF122.mp3")
resource.AddFile("sound/soundmaster/step_ac/0xFAF123.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x03552660.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x03ECBDB5.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x097531DA.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x0A70157C.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x0E34BC18.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x119FC2F5.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x129C3159.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x140F470D.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x15B2EC01.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1645E267.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1B1BB6D3.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1C9F58ED.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1D1361CC.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1D1519DC.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1F6B0AF7.mp3")
resource.AddFile("sound/soundmaster/vending_machine_ac/0x1F8DFFB8.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0AE528B0.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0B95F40B.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0CD31F62.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0E4D225D.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0E9A13A9.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0E29F5C9.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0E299616.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0FACE51E.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0FC1D5C5.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x01E07D82.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x1C9EFEFF.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x1D8A3156.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x1E7AD9D5.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x1E805676.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x1F9684EA.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x05D20947.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x06B8CE61.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x11A57793.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x11E5A7BB.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x12ED6B95.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x0157C86A.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x16879DE0.wav")
resource.AddFile("sound/soundmaster/weather_ac/0x16879DE1.wav")
resource.AddFile("sound/soundmaster/weather_ac/0x139392D9.mp3")
resource.AddFile("sound/soundmaster/weather_ac/0x168348FE.mp3")
-------------------------------------------------------------------------
--Food
-------------------------------------------------------------------------
resource.AddFile("sound/soundmaster/food/yumyum.mp3")
resource.AddFile("sound/soundmaster/food/yumyum2.mp3")
resource.AddFile("sound/soundmaster/food/rulps1.mp3")
resource.AddFile("sound/soundmaster/food/rulps2.mp3")
resource.AddFile("sound/soundmaster/food/rulps3.mp3")
resource.AddFile("sound/soundmaster/food/rulps4.mp3")
resource.AddFile("sound/soundmaster/food/rulps5.mp3")
-------------------------------------------------------------------------
--Bought
-------------------------------------------------------------------------
resource.AddFile("sound/soundmaster/bought/cash.mp3")
-------------------------------------------------------------------------
--Essentials
-------------------------------------------------------------------------
resource.AddFile("sound/soundmaster/essentials/tear01.mp3")
resource.AddFile("sound/soundmaster/essentials/error01.mp3")
resource.AddFile("sound/soundmaster/essentials/success.wav")
resource.AddFile("sound/soundmaster/essentials/siren.wav")
MsgN(":::SoundMaster System geladen")

@ -0,0 +1,107 @@
SoundMaster = SoundMaster or {}
soundtable = {}
function soundtable.Random(data)
math.randomseed(math.random(0,255)*5)
return table.Random(data)
end
/*
stepgravel = "0xFAF102","0xFAF103","0xFAF104","0xFAF105","0xFAF106"
stepsnow = "0xFAF107","0xFAF108","0xFAF109","0xFAF10A","0xFAF10B"
*/
//TODO: Unter-Wasser Sound ["rustsurvival/underwater_lp.wav"]
function SoundMaster.EntityEmitSound(t)
--MsgN(t.SoundName)
--MsgN(t.Entity)
/*if CLIENT and CleanDeathCam.Active then
return
end*/
if t.SoundName == "plats/elevator_move_loop1.wav" then t.SoundName = "common/null.wav" return true end
if t.SoundName == "ambient/water/underwater.wav" then
return false
end
--[[if t.SoundName == "vcmod/surface_grind.wav" then
return false
end--]]
if t.SoundName == "npc/scanner/scanner_photo1.wav" then
t.SoundName = "soundmaster/camera_ac/"..soundtable.Random({
"0x0C4E9EBF","0x1B33E508",
"0x1F6744EF","0x06DAFC36",
"0x08D657CA","0x11AD297B",
"0x098D81BF","0x1114D0AA",
})..".mp3"
return true
end
if string.find(t.SoundName,"physics/") and CLIENT then
if string.find(t.SoundName,"physics/wood/wood_box_footstep") then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF118","0xFAF119","0xFAF120","0xFAF121","0xFAF122","0xFAF123"})..".mp3"
return true
end
end
if string.find(t.SoundName,"player/footsteps/") and CLIENT then
if LocalPlayer():WaterLevel() > 1 then return false end --Unter-Wasser schritte deaktivieren
local stub = string.sub(t.SoundName,18,-5)
stub = string.sub(stub,0,string.len(stub)-1)
if stub == "grass" then
t.SoundName = "player/newfootsteps/grass"..math.random(1,4)..".wav"
return true
end
if stub == "metal" then
t.SoundName = "player/newfootsteps/metal"..math.random(1,5)..".wav"
return true
end
if stub == "sand" then
t.SoundName = "player/newfootsteps/sand"..math.random(1,5)..".wav"
return true
end
if stub == "wood" then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF118","0xFAF119","0xFAF120","0xFAF121","0xFAF122","0xFAF123"})..".mp3"
return true
end
if stub == "gravel" then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF102","0xFAF103","0xFAF104","0xFAF105","0xFAF106"})..".mp3"
return true
end
if stub == "dirt" then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF0E6","0xFAF0E7","0xFAF0E8","0xFAF0E9","0xFAF101"})..".mp3"
return true
end
if stub == "stone" or stub == "concrete" or stub == "tile" then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF10C","0xFAF10D","0xFAF10E","0xFAF110","0xFAF111","0xFAF112"})..".mp3"
return true
end
if stub == "slosh" or stub == "wade" then
t.SoundName = "soundmaster/step_ac/"..soundtable.Random({"0xFAF113","0xFAF114","0xFAF115","0xFAF116","0xFAF117"})..".mp3"
return true
end
end
if t.SoundName == "items/flashlight1.wav" then t.SoundName = "rustsurvival/flashlight_toggle.mp3" return true end
if IsValid(t.Entity) then
if t.Entity:IsVehicle() then
local replacements = {
["physics/metal/*"] = {
"0x00CED401","0x0DF65CA9",
"0x0F481DDD","0x1AF0B69D",
"0x1F56FF6A","0x03E4DA2C",
"0x15E86B1D","0x18B930BF",
"0x0450C95F","0x16387ED3",
}
}
for i,k in pairs(replacements) do
if string.find(t.SoundName,i) then
t.SoundName = "soundmaster/carcrash_ac/"..table.Random(k)..".mp3"
return true
end
end
end
if t.Entity == Entity(0) and string.find(t.SoundName,"explode") then
t.SoundName = "rustsurvival/ambient/a_explosion.mp3"
return true
end
if t.Entity == Entity(0) and string.find(t.SoundName,"ambient") then t.SoundName = "common/null.wav" return true end
if t.Entity:IsVehicle() and string.find(t.SoundName,"explode") then
t.SoundName = "soundmaster/carexplosion_ac/"..soundtable.Random({"0x1D0B27DF","0x0FEDCD9C"})..".mp3"
return true
end
end
end
hook.Add("EntityEmitSound","SoundMaster.EntityEmitSound",SoundMaster.EntityEmitSound)

@ -0,0 +1,27 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 Jonas Hogeback / UltimateRP
All Rights Reserved
Website: UltimateRP.net
-----------------------------------------------------------*/
SoundMaster = SoundMaster or {}
-- SoundMaster.BoughtSound(Player(), Typ String, Mode String)
-- Example:
-- SoundMaster.BoughtSound(ply,"ca_ching", "local")
function SoundMaster.BoughtSound(activator,typ,mode)
-- Sound Type
if (typ == "ca_ching") then
pitch = math.random(70, 130)
sound = "soundmaster/bought/cash.mp3"
end
-- Local or Global
if (mode == "global") then
activator:EmitSound(sound, 100, pitch)
elseif (mode == "local") then
activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
end
end

@ -0,0 +1,109 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 Jonas Hogeback / UltimateRP
All Rights Reserved
Website: UltimateRP.net
-----------------------------------------------------------*/
SoundMaster = SoundMaster or {}
-- SoundMaster.TearSound(Player(), Typ String, Mode String)
-- Example:
-- SoundMaster.TearSound(ply,"tear01", "local")
function SoundMaster.TearSound(activator,typ,mode)
-- Sound Type
if (typ == "random") then
pitch = math.random(70, 130)
sounds = {"soundmaster/essentials/tear01.mp3"}
sound = sounds[math.random(1, #sounds)]
end
if (typ == "tear01") then
pitch = math.random(70, 130)
sound = "soundmaster/essentials/tear01.mp3"
end
-- Local or Global
if (mode == "global") then
activator:EmitSound(sound, 100, pitch)
elseif (mode == "local") then
activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
end
end
-- SoundMaster.SuccessSound(Player(), Typ String, Mode String)
-- Example:
-- SoundMaster.SuccessSound(ply,"success", "local")
function SoundMaster.SuccessSound(activator,typ,mode)
-- Sound Type
if (typ == "random") then
pitch = math.random(70, 130)
sounds = {"soundmaster/essentials/success.wav"}
sound = sounds[math.random(1, #sounds)]
end
if (typ == "success") then
pitch = math.random(70, 130)
sound = "soundmaster/essentials/success.wav"
end
-- Local or Global
if (mode == "global") then
activator:EmitSound(sound, 100, pitch)
elseif (mode == "local") then
activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
end
end
-- SoundMaster.ErrorSound(Player(), Typ String, Mode String)
-- Example:
-- SoundMaster.ErrorSound(ply,"error01", "local")
function SoundMaster.ErrorSound(activator,typ,mode)
-- Sound Type
if (typ == "random") then
pitch = math.random(70, 90)
sounds = {"soundmaster/essentials/error01.mp3"}
sound = sounds[math.random(1, #sounds)]
end
if (typ == "error01") then
pitch = math.random(70, 90)
sound = "soundmaster/essentials/error01.mp3"
end
-- Local or Global
if (mode == "global") then
activator:EmitSound(sound, 100, pitch)
elseif (mode == "local") then
activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
end
end
-- SoundMaster.SirenSound(Player(), Typ String, Mode String)
-- Example:
-- SoundMaster.SirenSound(ply,"siren", "local")
function SoundMaster.SirenSound(activator,typ,mode)
-- Sound Type
if (typ == "random") then
pitch = math.random(70, 130)
sounds = {"soundmaster/essentials/siren.wav"}
sound = sounds[math.random(1, #sounds)]
end
if (typ == "siren") then
pitch = math.random(70, 130)
sound = "soundmaster/essentials/siren.wav"
end
-- Local or Global
if (mode == "global") then
activator:EmitSound(sound, 100, pitch)
elseif (mode == "local") then
activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
end
end

@ -0,0 +1,34 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 Jonas Hogeback / UltimateRP
All Rights Reserved
Website: UltimateRP.net
-----------------------------------------------------------*/
SoundMaster = SoundMaster or {}
function SoundMaster.EatSound(activator,rulps)
local sounds =
{
{"soundmaster/food/yumyum.mp3", 2.3},
{"soundmaster/food/yumyum2.mp3", 3}
}
local rand = math.random(1, #sounds)
activator:EmitSound(sounds[rand][1], 100, math.random(70, 130))
if rulps then
timer.Simple(sounds[rand][2],function()
local sounds = {
"soundmaster/food/rulps1.mp3",
"soundmaster/food/rulps2.mp3",
"soundmaster/food/rulps3.mp3",
"soundmaster/food/rulps4.mp3",
"soundmaster/food/rulps5.mp3"
}
local rand = math.random(1, #sounds)
activator:EmitSound(sounds[rand], 100, math.random(50, 130))
end)
end
end

File diff suppressed because it is too large Load Diff

@ -0,0 +1,29 @@
SoundMaster = SoundMaster or {}
function SoundMaster.EntityEmitSound(t)
if string.find(t.SoundName,"vehicles") then return end
--MsgN(t.SoundName)
--MsgN(t.Entity)
if IsValid(t.Entity) then
if t.SoundName == "plats/elevator_move_loop1.wav" then t.SoundName == "common/null.wav" return true end
if t.Entity == Entity(0) and string.find(t.SoundName,"ambient") then t.SoundName = "null.wav" return true end
if t.Entity:IsPlayer() and t.SoundName == "items/flashlight1.wav" then t.SoundName = "rustsurvival/flashlight_toggle.mp3" return true end
if t.Entity:IsVehicle() then
local replacements = {
["physics/metal/*"] = {
"0x00CED401","0x0DF65CA9",
"0x0F481DDD","0x1AF0B69D",
"0x1F56FF6A","0x03E4DA2C",
"0x15E86B1D","0x18B930BF",
"0x0450C95F","0x16387ED3",
}
}
for i,k in pairs(replacements) do
if string.find(t.SoundName,i) then
t.SoundName = "soundmaster/carcrash_ac/"..table.Random(k)..".mp3"
return true
end
end
end
end
end
hook.Add("EntityEmitSound","SoundMaster.EntityEmitSound",SoundMaster.EntityEmitSound)

@ -0,0 +1,26 @@
/*---------------------------------------------------------
CleanRP SoundMaster
Copyright © 2017 4thebadwolfsky
All Rights Reserved
Website: derauto.de
-----------------------------------------------------------*/
AddCSLuaFile()
WeatherSounds = {}
WeatherSounds["thunder"] = {}
WeatherSounds["thunder"]["blitz"] = {"0x06B8CE61","0x11E5A7BB","0x139392D9"}
WeatherSounds["thunder"]["donner"] = {"0x168348FE","0x0CD31F62","0x05D20947","0x0157C86A"}
function SoundMaster.Thunderfar(p,a,b,v)
--sound.Play( "simpleweather/thunderfar" .. math.random( 1, 2 ) .. ".mp3",p,a,b,v)
sound.Play( "soundmaster/weather_ac/" .. table.Random(WeatherSounds["thunder"]["donner"]) .. ".mp3",p,a,b,v)
end
function SoundMaster.WindSound()
LocalPlayer():EmitSound("rustsurvival/ambient/a_windgust_light"..math.random(1,4)..".mp3")
end
function SoundMaster.ThunderLighning(p,a,b,v)
--sound.Play( "simpleweather/thunder" .. math.random( 1, 3 ) .. ".mp3",p,a,b,v)
--sound.Play( "simpleweather/lightning" .. math.random( 1, 4 ) .. ".mp3",p,a,b,v)
SoundMaster.Thunderfar(p,a,b,v)
sound.Play( "soundmaster/weather_ac/" .. table.Random(WeatherSounds["thunder"]["blitz"]) .. ".mp3",p,a,b,v)
end
Loading…
Cancel
Save