Fix a late joining client not knowing if the lobby has been paused (#1199)
* Fix client not knowing that the lobby is paused when joining after the pause Also fixes a client thinking that a lobby is paused when joining a new one after leaving a previously paused one * Add server announcement to delaying and pausing round start
This commit is contained in:
@@ -55,6 +55,7 @@ namespace Content.Client.GameTicking
|
||||
StartTime = message.StartTime;
|
||||
IsGameStarted = message.IsRoundStarted;
|
||||
AreWeReady = message.YouAreReady;
|
||||
Paused = message.Paused;
|
||||
|
||||
LobbyStatusUpdated?.Invoke();
|
||||
}
|
||||
|
||||
@@ -437,6 +437,8 @@ namespace Content.Server.GameTicking
|
||||
lobbyCountdownMessage.Paused = Paused;
|
||||
_netManager.ServerSendToAll(lobbyCountdownMessage);
|
||||
|
||||
_chatManager.DispatchServerAnnouncement($"Round start has been delayed for {time.TotalSeconds} seconds.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -463,6 +465,10 @@ namespace Content.Server.GameTicking
|
||||
lobbyCountdownMessage.Paused = Paused;
|
||||
_netManager.ServerSendToAll(lobbyCountdownMessage);
|
||||
|
||||
_chatManager.DispatchServerAnnouncement(Paused
|
||||
? "Round start has been paused."
|
||||
: "Round start countdown is now resumed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -838,6 +844,7 @@ namespace Content.Server.GameTicking
|
||||
msg.IsRoundStarted = RunLevel != GameRunLevel.PreRoundLobby;
|
||||
msg.StartTime = _roundStartTimeUtc;
|
||||
msg.YouAreReady = ready;
|
||||
msg.Paused = Paused;
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace Content.Shared
|
||||
public bool YouAreReady { get; set; }
|
||||
// UTC.
|
||||
public DateTime StartTime { get; set; }
|
||||
public bool Paused { get; set; }
|
||||
|
||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
||||
{
|
||||
@@ -78,6 +79,7 @@ namespace Content.Shared
|
||||
|
||||
YouAreReady = buffer.ReadBoolean();
|
||||
StartTime = new DateTime(buffer.ReadInt64(), DateTimeKind.Utc);
|
||||
Paused = buffer.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
||||
@@ -91,6 +93,7 @@ namespace Content.Shared
|
||||
|
||||
buffer.Write(YouAreReady);
|
||||
buffer.Write(StartTime.Ticks);
|
||||
buffer.Write(Paused);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user