]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix RoundStartTimeSpan not being networked on client-side after reconnecting (#23707)
authorDoutorWhite <68350815+DoutorWhite@users.noreply.github.com>
Mon, 8 Jan 2024 00:30:10 +0000 (21:30 -0300)
committerGitHub <noreply@github.com>
Mon, 8 Jan 2024 00:30:10 +0000 (19:30 -0500)
Fix RoundStartTimeSpan state not being networked on reconnections

Content.Client/GameTicking/Managers/ClientGameTicker.cs
Content.Server/GameTicking/GameTicker.Lobby.cs
Content.Server/GameTicking/GameTicker.Player.cs
Content.Shared/GameTicking/SharedGameTicker.cs

index 1d44430c910c6e7651dd9e6f5ace797cf3242ec2..a62ebab1b7bda5d81bf217dc4b727ffb11c106f5 100644 (file)
@@ -57,6 +57,7 @@ namespace Content.Client.GameTicking.Managers
 
             SubscribeNetworkEvent<TickerJoinLobbyEvent>(JoinLobby);
             SubscribeNetworkEvent<TickerJoinGameEvent>(JoinGame);
+            SubscribeNetworkEvent<TickerConnectionStatusEvent>(ConnectionStatus);
             SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
             SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
             SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
@@ -110,6 +111,11 @@ namespace Content.Client.GameTicking.Managers
             _stateManager.RequestStateChange<LobbyState>();
         }
 
+        private void ConnectionStatus(TickerConnectionStatusEvent message)
+        {
+            RoundStartTimeSpan = message.RoundStartTimeSpan;
+        }
+
         private void LobbyStatus(TickerLobbyStatusEvent message)
         {
             StartTime = message.StartTime;
index b31472ffa4c0c26634db6cea8e636a1850aaf0bc..cbccda73fc97a00bda6dcc6ff938f4584926e29d 100644 (file)
@@ -86,10 +86,15 @@ namespace Content.Server.GameTicking
                 ("desc", desc));
         }
 
+        private TickerConnectionStatusEvent GetConnectionStatusMsg()
+        {
+            return new TickerConnectionStatusEvent(RoundStartTimeSpan);
+        }
+
         private TickerLobbyStatusEvent GetStatusMsg(ICommonSession session)
         {
             _playerGameStatuses.TryGetValue(session.UserId, out var status);
-            return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground,status == PlayerGameStatus.ReadyToPlay, _roundStartTime, RoundPreloadTime, RoundStartTimeSpan, Paused);
+            return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground, status == PlayerGameStatus.ReadyToPlay, _roundStartTime, RoundPreloadTime, RoundStartTimeSpan, Paused);
         }
 
         private void SendStatusToAll()
index 5fccee1d116bacaf5c097d72effb0f9992673eda..ec1f0e368a44f2a584933bda4a984164a11b3950 100644 (file)
@@ -66,6 +66,8 @@ namespace Content.Server.GameTicking
                         ? Loc.GetString("player-first-join-message", ("name", args.Session.Name))
                         : Loc.GetString("player-join-message", ("name", args.Session.Name)));
 
+                    RaiseNetworkEvent(GetConnectionStatusMsg(), session.Channel);
+
                     if (LobbyEnabled && _roundStartCountdownHasNotStartedYetDueToNoPlayers)
                     {
                         _roundStartCountdownHasNotStartedYetDueToNoPlayers = false;
index d8ce4585a735ab7d491cb7a987239f0cdc646338..dac33fe5a764cbc55761ce4cea22b84517153314 100644 (file)
@@ -63,6 +63,15 @@ namespace Content.Shared.GameTicking
         }
     }
 
+    [Serializable, NetSerializable]
+    public sealed class TickerConnectionStatusEvent : EntityEventArgs
+    {
+        public TimeSpan RoundStartTimeSpan { get; }
+        public TickerConnectionStatusEvent(TimeSpan roundStartTimeSpan)
+        {
+            RoundStartTimeSpan = roundStartTimeSpan;
+        }
+    }
 
     [Serializable, NetSerializable]
     public sealed class TickerLobbyStatusEvent : EntityEventArgs