-- Decompiled with the Synapse X Luau decompiler.

local v1 = {};
local l__TweenService__2 = game:GetService("TweenService");
v1.module_events = require(script.Parent.Parent.Module_Events);
local u1 = game:GetService("ReplicatedStorage").Misc.Eyes:GetChildren();
function v1.tease(p1, p2, p3, p4, p5)
	local u2 = p4;
	spawn(function()
		if not u2 then
			u2 = math.random(1, 500);
		end;
		u2 = Random.new(u2);
		local v3 = {};
		local v4 = {};
		for v5, v6 in pairs(p2:GetDescendants()) do
			if v6:IsA("BasePart") then
				if v6.Name == "Wall" or v6.Name == "Wall_Strip" then
					table.insert(v3, v6);
				end;
				if v6.Name == "Carpet" then
					table.insert(v4, v6);
				end;
			end;
		end;
		if #v4 <= 0 then
			for v7, v8 in pairs(p2:GetDescendants()) do
				if v8:IsA("BasePart") and v8.Name == "Floor" then
					table.insert(v4, v8);
				end;
			end;
		end;
		local v9 = RaycastParams.new();
		v9.CollisionGroup = "CheckWallStuff";
		local v10 = RaycastParams.new();
		v10.CollisionGroup = "CheckWallStuff";
		v1.module_events.flickerLights(p2, math.clamp(p3 / 5, 0.4, 1));
		local v11 = p3;
		for v12 = 1, 100 do
			local v13 = workspace:Raycast(v4[u2:NextInteger(1, #v4)].Position + Vector3.new(u2:NextInteger(-5, 5), u2:NextInteger(5, 11), u2:NextInteger(-5, 5)), CFrame.Angles(0, math.rad(u2:NextInteger(0, 360)), 0).LookVector * 150, v9);
			local v14 = Vector3.new(4, 2, 0);
			if v13 then
				local l__Position__15 = v13.Position;
				local l__Instance__16 = v13.Instance;
				local l__Normal__17 = v13.Normal;
				if l__Position__15 and l__Instance__16 and l__Instance__16.Anchored == true and (l__Instance__16.Name == "Wall" or l__Instance__16.Name == "WallAlt") then
					for v18 = 1, 4 do
						if v18 <= 2 then
							local v19 = 1;
						else
							v19 = -1;
						end;
						if v18 == 2 or v18 == 4 then
							local v20 = 1;
						else
							v20 = -1;
						end;
						local v21 = workspace:Raycast((CFrame.new(l__Position__15 + l__Normal__17, l__Position__15) * CFrame.new(v14.X / 2 * v19, v14.Y / 2 * v20, 0)).p, l__Normal__17 * -1.1, v10);
						if not v21 then
							local v22 = false;
							break;
						end;
						local l__Instance__23 = v21.Instance;
						local l__Normal__24 = v21.Normal;
						if not v21.Position then
							v22 = false;
							break;
						end;
						if not l__Instance__23 then
							v22 = false;
							break;
						end;
						if l__Instance__23.Anchored ~= true then
							v22 = false;
							break;
						end;
						if l__Instance__23.Name ~= "Wall" and l__Instance__23.Name ~= "WallAlt" then
							v22 = false;
							break;
						end;
					end;
				else
					v22 = false;
				end;
				if v22 == true then
					local v25 = u1[u2:NextInteger(1, #u1)]:Clone();
					v25:SetPrimaryPartCFrame(CFrame.new(l__Position__15, l__Position__15 + l__Normal__17) * CFrame.Angles(0, 0, math.rad(u2:NextInteger(-20, 20))));
					v25.Parent = p2;
					v25.PrimaryPart.PlaySound:Play();
					v25.PrimaryPart.Splat.Pitch = u2:NextInteger(80, 120) / 100;
					v25.PrimaryPart.Splat:Play();
					spawn(function()
						pcall(function()
							task.delay(3, function()
								for v26, v27 in pairs(v25:GetDescendants()) do
									if v27:IsA("BasePart") then
										v27.CanCollide = false;
										v27.CanQuery = false;
										v27.CanTouch = false;
										v27.CollisionGroupId = 1;
									end;
								end;
							end);
						end);
						if UserSettings().GameSettings.SavedQualityLevel.Value >= 5 then
							pcall(function()
								for v28 = 1, math.random(1, 3) do
									wait(math.random(5, 50) / 10);
									v25.Eye.Transparency = 1;
									v25.Eye.Decal.Transparency = 1;
									v25.PrimaryPart.ParticleEmitter:Emit(2);
									v25.PrimaryPart.Blink.Pitch = u2:NextInteger(80, 120) / 120;
									v25.PrimaryPart.Blink:Play();
									wait(0.1);
									v25.Eye.Transparency = 0;
									v25.Eye.Decal.Transparency = 0;
								end;
							end);
						end;
					end);
					v11 = v11 - 1;
				end;
			end;
			task.wait(0.016666666666666666);
			if v11 <= 0 then
				break;
			end;
		end;
	end);
	if p5 == true then
		spawn(function()
			for v29, v30 in pairs(p2:GetDescendants()) do
				if UserSettings().GameSettings.SavedQualityLevel.Value >= 5 and v30:IsA("BasePart") and (v30.Name == "Wall" or v30.Name == "Wall_Strip" or v30.Name == "WallAlt" or v30.Name == "Floor" or v30.Name == "Carpet" or v30.Name == "Ceiling") then
					local v31 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left, Enum.NormalId.Top, Enum.NormalId.Bottom };
					if v30.Name == "Wall" or v30.Name == "Wall_Strip" or v30.Name == "WallAlt" then
						v31 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left };
					end;
					if v30.Name == "Floor" or v30.Name == "Carpet" then
						v31 = { Enum.NormalId.Top };
					end;
					if v30.Name == "Ceiling" then
						v31 = { Enum.NormalId.Bottom };
					end;
					for v32, v33 in pairs(v31) do
						local v34 = game:GetService("ReplicatedStorage").Misc.EyesTexture:Clone();
						v34.Face = v33;
						v34.Parent = v30;
						task.spawn(function()
							local v35 = tick();
							for v36 = 1, 100 do
								v34.OffsetStudsU = math.random(-50, 50);
								v34.OffsetStudsV = math.random(-50, 50);
								task.wait(math.random(20, 100) / 100);
								if v35 + 12 <= tick() then
									break;
								end;
							end;
						end);
						game.Debris:AddItem(v34, 12);
					end;
				end;
			end;
		end);
	end;
end;
return v1;