diff --git a/ProjectLighthouse/Helpers/MatchHelper.cs b/ProjectLighthouse/Helpers/MatchHelper.cs index aa7d5908..45519705 100644 --- a/ProjectLighthouse/Helpers/MatchHelper.cs +++ b/ProjectLighthouse/Helpers/MatchHelper.cs @@ -36,6 +36,8 @@ public static class MatchHelper return recentlyDivedIn.Contains(otherUserId); } + public static bool ClearUserRecentDiveIns(int userId) => UserRecentlyDivedIn.Remove(userId); + // This is the function used to show people how laughably awful LBP's protocol is. Beware. public static IMatchCommand? Deserialize(string data) { diff --git a/ProjectLighthouse/Match/Rooms/RoomHelper.cs b/ProjectLighthouse/Match/Rooms/RoomHelper.cs index 6c6f4fff..2e0c998d 100644 --- a/ProjectLighthouse/Match/Rooms/RoomHelper.cs +++ b/ProjectLighthouse/Match/Rooms/RoomHelper.cs @@ -1,4 +1,5 @@ #nullable enable +using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; @@ -47,10 +48,10 @@ public class RoomHelper return null; } - IEnumerable rooms = Rooms; + Random random = new(); + IEnumerable rooms = Rooms.OrderBy(_ => random.Next()); rooms = rooms.OrderBy(r => r.IsLookingForPlayers); - rooms = rooms.Where(r => r.RoomVersion == roomVersion).ToList(); if (platform != null) rooms = rooms.Where(r => r.RoomPlatform == platform).ToList(); @@ -137,6 +138,12 @@ public class RoomHelper return response; } + if (user != null) + { + MatchHelper.ClearUserRecentDiveIns(user.UserId); + Logger.Info($"Cleared {user.Username} (id: {user.UserId})'s recent dive-ins", LogArea.Match); + } + return null; }