local MAP_NAME = game.GetMap() if MAP_NAME ~= "fh_2house_night" then return end local positions = { Vector(3036, -3908, 1100), Vector(-2327, -5379, 1300), Vector(-3571, 3085, 1200), Vector(5929, 1181, 1200), Vector(946, 2933, 1300), } local distantS = { ")ambient/ambience/thunder_distant01.wav", ")ambient/ambience/thunder_distant02.wav", ")ambient/ambience/thunder_distant03.wav", } local closeS = { ")ambient/ambience/thunder_close01.wav", ")ambient/ambience/thunder_close02.wav", ")ambient/ambience/thunder_close03.wav", ")ambient/ambience/thunder_close03.wav", } local loudAF = { ")ambient/ambience/big_boss_thunder.mp3", } local function getRandom(t) return t[math.random(#t)] end local mintime = 18 local maxtime = 34 if SERVER then util.AddNetworkString("2house_thunder_sound") hook.Add("InitPostEntity", "2house_n_thunder", function() timer.Create("2house_thunder_225", math.random(mintime,maxtime), 0, function() local distant = math.random(1,2) == 1 net.Start("2house_thunder_sound") net.WriteBool(distant) net.WriteBool(!distant and math.random(1,20) == 1) net.WriteVector(getRandom(positions)) net.Broadcast() timer.Adjust("2house_thunder_225", math.random(mintime,maxtime)) end) end) end if CLIENT then local myself net.Receive("2house_thunder_sound", function() local distant = net.ReadBool() local earKiller = net.ReadBool() local pos = net.ReadVector() myself = myself or LocalPlayer() if not IsValid(myself) then return end if earKiller then pos = Vector(-512, 0, 1300) end local dir = (pos - myself:EyePos()):GetNormalized() local angle = (myself:EyePos() - pos):Angle() local soundPos = myself:EyePos() + dir * 35 local sound if !earKiller then sound = distant and getRandom(distantS) or getRandom(closeS) else sound = getRandom(loudAF) end local bright = 1000 local brush = ClientsideModel("models/propper/fh_2house_night/mybrush.mdl") brush:SetPos(Vector(-512, 0, -1904)) brush:Spawn() local ebanuloDensity = 0.4 hook.Add("SetupWorldFog", "fh_2house_night_fog", function(scale) local start, endD, fogz = render.GetFogDistances() render.FogMode(MATERIAL_FOG_LINEAR) render.FogStart(0) render.FogEnd(3200) render.SetFogZ(fogz) render.FogColor(render.GetFogColor()) ebanuloDensity = ebanuloDensity + FrameTime() render.FogMaxDensity(math.min(1, ebanuloDensity)) return true end) timer.Simple(0.4, function() hook.Remove("SetupWorldFog", "fh_2house_night_fog") end) if IsValid( brush ) then local hidden = false for i = 1,3 do timer.Simple(0.1 * i, function() if IsValid( brush ) then hidden = not hidden brush:SetNoDraw(hidden) if i == 3 then brush:Remove() end end end) end end if myself:GetPos().z > 10 then timer.Simple(0.1, function() local GOVNO = ProjectedTexture() GOVNO:SetEnableShadows(true) GOVNO:SetLightWorld(true) GOVNO:SetTexture("effects/flashlight/soft") GOVNO:SetPos(pos) GOVNO:SetAngles(angle) GOVNO:SetColor(Color(255,255,255)) GOVNO:SetFOV(160) GOVNO:SetBrightness(bright) GOVNO:SetNearZ(1) GOVNO:SetFarZ(16000) GOVNO:Update() for i = 1,25 do timer.Simple(0.01 * i, function() if IsValid(GOVNO) then bright = bright - 50 GOVNO:SetBrightness(bright) GOVNO:Update() end end) end timer.Simple(0.25, function() if IsValid(GOVNO) then GOVNO:Remove() end end) end) end timer.Simple(distant and 0.6 or 0.2, function() EmitSound( sound, soundPos, earKiller and -1 or 0, CHAN_AUTO, 1, SNDLVL_180dB, 0, 100 ) end) end) end function spawnGOVNO() local GOVNO = ProjectedTexture() GOVNO:SetEnableShadows(true) GOVNO:SetLightWorld(true) GOVNO:SetTexture("effects/flashlight/soft") GOVNO:SetPos(LocalPlayer():GetPos() + Vector(0,0,2080)) GOVNO:SetAngles(Angle(79,0,0)) GOVNO:SetColor(Color(255,255,255)) GOVNO:SetFOV(160) GOVNO:SetBrightness(200) GOVNO:SetNearZ(1) GOVNO:SetFarZ(4000) GOVNO:Update() timer.Simple(5, function() GOVNO:Remove() end) end