-- Decompiled with the Synapse X Luau decompiler.


local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = require(script.Parent);
local v3 = require(script:FindFirstAncestor("MainUI").Modules.WindShake);
local v4 = require(l__LocalPlayer__1:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v5 = game["Run Service"];
local l__UserInputService__6 = game:GetService("UserInputService");
local l__TweenService__7 = game:GetService("TweenService");
local v8 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("Module_Events"));
v3:Init();
v2.gd:WaitForChild("ChaseInSession").Changed:Connect(function(p1)

end);
local function v9()
	local v10 = workspace.CurrentRooms:FindFirstChild(v2.gd.LatestRoom.Value);
	if v10 and v10:GetAttribute("RequiresKey") == true then

	end;
	if v10:WaitForChild("Door", 1) then
		local l__Door__11 = v10:FindFirstChild("Door");
		local v12 = 12;
		if v2.chase then
			v12 = 24;
		end;
		if l__Door__11 then
			local l__Value__1 = v2.gd.LatestRoom.Value;
			task.spawn(function()
				for v13 = 1, 10000 do
					wait(0.1);
					if l__Value__1 < tonumber(l__LocalPlayer__1:GetAttribute("CurrentRoom")) then
						return;
					end;
					if (l__LocalPlayer__1.Character.PrimaryPart.Position - l__Door__11.PrimaryPart.Position).Magnitude < v12 then
						local v14 = RaycastParams.new();
						v14.CollisionGroup = "Player";
						v14.FilterDescendantsInstances = { l__Door__11, l__LocalPlayer__1.Character };
						local v15 = workspace:Raycast(l__LocalPlayer__1.Character.PrimaryPart.Position, CFrame.new(l__LocalPlayer__1.Character.PrimaryPart.Position, l__Door__11.PrimaryPart.Position).LookVector * (l__LocalPlayer__1.Character.PrimaryPart.Position - l__Door__11.PrimaryPart.Position).Magnitude, v14);
						if not v15 then
							l__Door__11.ClientOpen:FireServer();
							return;
						end;
						if not v15.Position then
							l__Door__11.ClientOpen:FireServer();
							return;
						end;
					end;
				end;
			end);
		end;
	end;
	if v10:FindFirstChild("Shopkeeper") then
		require(script.Shopkeeper).run(v10);
	end;
	local v16, v17, v18 = ipairs(v10:GetDescendants());
	while true do
		v16(v17, v18);
		if not v16 then
			break;
		end;
		v18 = v16;
		if v17:IsA("BasePart") and v17:GetAttribute("WindShake") == true then
			print("sup");
			v3:AddObjectShake(v17);
		elseif v17.Name == "GuidingLightStuff" or v17.Name == "HelpLight" or v17.Name == "HelpParticle" then
			if v17:IsA("SpotLight") then
				if UserSettings().GameSettings.SavedQualityLevel.Value <= 4 then
					v17.Color = Color3.fromRGB(39, 190, 255);
					v17.Brightness = 8;
					v17.Range = 32;
					v17.Angle = 40;
				end;
			elseif v17:IsA("ParticleEmitter") and UserSettings().GameSettings.SavedQualityLevel.Value <= 5 then
				v17.Rate = 50;
			end;
		end;	
	end;
	if v10:GetAttribute("Header") ~= nil and v10:GetAttribute("Header") ~= "" and v10:GetAttribute("Header") ~= " " then
		print("doing header");
		v2.titlelocation(v10:GetAttribute("Header"));
	end;
	if v10:FindFirstChild("FigureSetup", true) then
		local l__FigureRagdoll__19 = v10:FindFirstChild("FigureSetup", true).FigureRagdoll;
		local l__Parent__20 = l__FigureRagdoll__19.Parent;
		local v21 = 0;
		local l__Click__22 = l__FigureRagdoll__19.Head.Click;
		local l__Growl__23 = l__FigureRagdoll__19.Head.Growl;
		local v24 = {};
		for v25, v26 in pairs(l__FigureRagdoll__19:GetDescendants()) do
			if v26:IsA("Light") and v26.Name == "BlisterLight" then
				v26.Enabled = true;
				v26.Brightness = 0;
				table.insert(v24, {
					Light = v26, 
					Distance = l__FigureRagdoll__19.Head.Position - v26.Parent.WorldPosition
				});
			end;
		end;
		local v27 = TweenInfo.new(0.1, Enum.EasingStyle.Linear);
		for v28 = 1, 100000000 do
			wait(0.1);
			if not l__FigureRagdoll__19 then
				break;
			end;
			if l__FigureRagdoll__19.Parent ~= l__Parent__20 then
				break;
			end;
			local v29 = (l__Click__22.PlaybackLoudness + l__Growl__23.PlaybackLoudness) / 60;
			if v29 ~= v21 then
				for v30, v31 in v24, nil do
					delay(v31.Distance / 2, function()
						l__TweenService__7:Create(v31.Light, v27, {
							Brightness = v29
						}):Play();
					end);
				end;
			end;
			v21 = v29;
		end;
	end;
	if v10:FindFirstChild("FigureAnimatedWelded", true) then
		local l__FigureAnimatedWelded__32 = v10:FindFirstChild("FigureAnimatedWelded", true);
		local l__Parent__33 = l__FigureAnimatedWelded__32.Parent;
		local v34 = 0;
		local l__Click__35 = l__FigureAnimatedWelded__32.Parent.Head.Click;
		local l__Growl__36 = l__FigureAnimatedWelded__32.Parent.Head.Growl;
		local v37 = {};
		for v38, v39 in pairs(l__FigureAnimatedWelded__32:GetDescendants()) do
			if v39:IsA("Light") and v39.Name == "BlisterLight" then
				v39.Enabled = true;
				v39.Brightness = 0;
				table.insert(v37, {
					Light = v39, 
					Distance = l__FigureAnimatedWelded__32.Parent.Head.Position - v39.Parent.WorldPosition
				});
			end;
		end;
		local v40 = TweenInfo.new(0.1, Enum.EasingStyle.Linear);
		for v41 = 1, 100000000 do
			wait(0.1);
			if not l__FigureAnimatedWelded__32 then
				break;
			end;
			if l__FigureAnimatedWelded__32.Parent ~= l__Parent__33 then
				break;
			end;
			local v42 = (l__Click__35.PlaybackLoudness + l__Growl__36.PlaybackLoudness) / 90 - 0.15;
			if v42 ~= v34 then
				for v43, v44 in v37, nil do
					delay(v44.Distance / 4, function()
						l__TweenService__7:Create(v44.Light, v40, {
							Brightness = v42
						}):Play();
					end);
				end;
			end;
			v34 = v42;
		end;
	end;
end;
v2.gd:WaitForChild("FinishedLoadingRoom").Changed:Connect(v9);
v2.gd:WaitForChild("Preload").Changed:Connect(v9);
workspace:WaitForChild("Ambience_Dark").Played:Connect(function()

end);
l__LocalPlayer__1:GetAttributeChangedSignal("CurrentRoom"):Connect(function()
	local v45 = workspace.CurrentRooms:FindFirstChild(l__LocalPlayer__1:GetAttribute("CurrentRoom"));
	if v45 then
		local v46 = Color3.fromRGB(67, 51, 56);
		local v47 = v45:GetAttribute("Ambient");
		if v47 and type(v47) == "userdata" then
			v46 = v47;
		end;
		l__TweenService__7:Create(game.Lighting, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
			Ambient = v46
		}):Play();
	end;
end);
local l__Shopkeeper__48 = workspace:FindFirstChild("Shopkeeper", true);
if l__Shopkeeper__48 then
	require(script.Shopkeeper).run(l__Shopkeeper__48.Parent);
end;
