diff --git a/ChobbyLauncher/ChobbyLauncher.csproj b/ChobbyLauncher/ChobbyLauncher.csproj index 19aff4d56..c97f60e57 100644 --- a/ChobbyLauncher/ChobbyLauncher.csproj +++ b/ChobbyLauncher/ChobbyLauncher.csproj @@ -163,7 +163,7 @@ - + diff --git a/ChobbyLauncher/CrashReportHelper.cs b/ChobbyLauncher/CrashReportHelper.cs index 13c1d7c23..39b46cc9e 100644 --- a/ChobbyLauncher/CrashReportHelper.cs +++ b/ChobbyLauncher/CrashReportHelper.cs @@ -209,32 +209,20 @@ private static async Task ReportCrash(string infolog, CrashType type, str private static int[] ReadGameReloads(string logStr) { - //Game reload detected by [f=-000001] that follows either the start of the file, or [f={non-negative value}] - - var list = new List(); - - var negativeFrameRegex = new Regex(@"f=-(?<=(?^)\[t=\d+:\d+:\d+\.\d+\]\[f=-)\d+\]", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, TimeSpan.FromSeconds(30)); - var nonNegativeFrameRegex = new Regex(@"f=\d(?<=^\[t=\d+:\d+:\d+\.\d+\]\[f=\d)\d*\]", RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, TimeSpan.FromSeconds(30)); - - var idx = 0; + //[t=00:00:30.569367][f=-000001] [ReloadOrRestart] Spring "E:\Games\SteamLibrary\steamapps\common\Zero-K\engine\win64\105.1.1-2457-g8095d30\spring.exe" should be reloading + //This happens whenever a new game is started, or when a game is exited and returns to lobby. try { - while (true) - { - { - var m = negativeFrameRegex.Match(logStr, idx); - if (!m.Success) break; - idx = m.Index; - list.Add(m.Groups["s"].Index); - } - { - var m = nonNegativeFrameRegex.Match(logStr, idx); - if (!m.Success) break; - idx = m.Index; - } - } - return list.ToArray(); + return + Regex + .Matches( + logStr, + @"\[ReloadOrRestart\](?<=(?^)\[t=\d+:\d+:\d+\.\d+\]\[f=-?\d+\] \[ReloadOrRestart\])", + RegexOptions.CultureInvariant | RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.Multiline, + TimeSpan.FromSeconds(30)) + .Cast().Select(m => m.Groups["s"].Index) + .ToArray(); } catch (RegexMatchTimeoutException) { diff --git a/ZkLobbyServer/SpringieInterface/StartSetup.cs b/ZkLobbyServer/SpringieInterface/StartSetup.cs index b1f300b33..fcb67eded 100644 --- a/ZkLobbyServer/SpringieInterface/StartSetup.cs +++ b/ZkLobbyServer/SpringieInterface/StartSetup.cs @@ -292,6 +292,13 @@ public static LobbyHostingContext GetDedicatedServerStartSetup(LobbyHostingConte * See https://github.com/ZeroK-RTS/Zero-K-Infrastructure/blob/master/Shared/LobbyClient/DedicatedServer.cs#L317 */ ret.ModOptions["sendSpringieData"] = "1"; + /* Current date. Synced Lua code cannot access `os.date` + * which is needed for gameside events (Easter etc) */ + var date = DateTime.UtcNow; + ret.ModOptions["date_day"] = date.Day.ToString(); + ret.ModOptions["date_month"] = date.Month.ToString(); + ret.ModOptions["date_year"] = date.Year.ToString(); + // set PW structures if (mode == AutohostMode.Planetwars) { diff --git a/ZkLobbyServer/ZkLobbyServer.cs b/ZkLobbyServer/ZkLobbyServer.cs index fe81cb001..bfc5146ab 100644 --- a/ZkLobbyServer/ZkLobbyServer.cs +++ b/ZkLobbyServer/ZkLobbyServer.cs @@ -212,6 +212,9 @@ public bool CanUserSee(ConnectedUser uWatcher, ConnectedUser uWatched) // admins always visible if (uWatched.User?.IsAdmin == true) return true; + // admins see everybody + if (uWatcher.User?.IsAdmin == true) return true; + // friends see each other if (uWatcher.FriendNames.Contains(uWatched.Name)) return true;