From 728c395bda8d791ce23d0c26ef35dce4de508ba1 Mon Sep 17 00:00:00 2001 From: theashtronaut <112137107+theashtronaut@users.noreply.github.com> Date: Tue, 8 Nov 2022 20:02:07 +0000 Subject: [PATCH] Add lobby ready count to game ticker info during pregame (#12157) * add lobby ready count to game ticker info * Update Resources/Locale/en-US/game-ticking/game-ticker.ftl Co-authored-by: Jacob Tong <10494922+ShadowCommander@users.noreply.github.com> * simplify get info loc Co-authored-by: Jacob Tong <10494922+ShadowCommander@users.noreply.github.com> --- Content.Server/GameTicking/GameTicker.Lobby.cs | 11 ++++++++--- Content.Server/GameTicking/GameTicker.RoundFlow.cs | 1 + Resources/Locale/en-US/game-ticking/game-ticker.ftl | 9 +++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Content.Server/GameTicking/GameTicker.Lobby.cs b/Content.Server/GameTicking/GameTicker.Lobby.cs index 728d8bad93..4dfa75d459 100644 --- a/Content.Server/GameTicking/GameTicker.Lobby.cs +++ b/Content.Server/GameTicking/GameTicker.Lobby.cs @@ -1,3 +1,4 @@ +using System.Linq; using Content.Shared.GameTicking; using Content.Server.Station.Systems; using Content.Server.Station.Components; @@ -42,8 +43,9 @@ namespace Content.Server.GameTicking { return string.Empty; } - + var playerCount = $"{_playerManager.PlayerCount}"; + var readyCount = _playerGameStatuses.Values.Count(x => x == PlayerGameStatus.ReadyToPlay); StringBuilder stationNames = new StringBuilder(); if (_stationSystem.Stations.Count != 0) @@ -65,10 +67,11 @@ namespace Content.Server.GameTicking { stationNames.Append(Loc.GetString("game-ticker-no-map-selected")); } - + var gmTitle = Loc.GetString(Preset.ModeTitle); var desc = Loc.GetString(Preset.Description); - return Loc.GetString("game-ticker-get-info-text",("roundId", RoundId), ("playerCount", playerCount),("mapName", stationNames.ToString()),("gmTitle", gmTitle),("desc", desc)); + return Loc.GetString(RunLevel == GameRunLevel.PreRoundLobby ? "game-ticker-get-info-preround-text" : "game-ticker-get-info-text", + ("roundId", RoundId), ("playerCount", playerCount), ("readyCount", readyCount), ("mapName", stationNames.ToString()),("gmTitle", gmTitle),("desc", desc)); } private TickerLobbyReadyEvent GetStatusSingle(ICommonSession player, PlayerGameStatus gameStatus) @@ -169,6 +172,8 @@ namespace Content.Server.GameTicking _playerGameStatuses[player.UserId] = ready ? PlayerGameStatus.ReadyToPlay : PlayerGameStatus.NotReadyToPlay; RaiseNetworkEvent(GetStatusMsg(player), player.ConnectedClient); RaiseNetworkEvent(GetStatusSingle(player, status)); + // update server info to reflect new ready count + UpdateInfoText(); } } } diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 78df4f397f..3c6ef158ec 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -243,6 +243,7 @@ namespace Content.Server.GameTicking ReqWindowAttentionAll(); UpdateLateJoinStatus(); AnnounceRound(); + UpdateInfoText(); #if EXCEPTION_TOLERANCE } diff --git a/Resources/Locale/en-US/game-ticking/game-ticker.ftl b/Resources/Locale/en-US/game-ticking/game-ticker.ftl index 6fd3b2aaa0..666317e54e 100644 --- a/Resources/Locale/en-US/game-ticking/game-ticker.ftl +++ b/Resources/Locale/en-US/game-ticking/game-ticker.ftl @@ -13,6 +13,15 @@ game-ticker-get-info-text = Hi and welcome to [color=white]Space Station 14![/co The current map is: [color=white]{$mapName}[/color] The current game mode is: [color=white]{$gmTitle}[/color] >[color=yellow]{$desc}[/color] +game-ticker-get-info-preround-text = Hi and welcome to [color=white]Space Station 14![/color] + The current round is: [color=white]#{$roundId}[/color] + The current player count is: [color=white]{$playerCount}[/color] ([color=white]{$readyCount}[/color] {$readyCount -> + [one] is + *[other] are + } ready) + The current map is: [color=white]{$mapName}[/color] + The current game mode is: [color=white]{$gmTitle}[/color] + >[color=yellow]{$desc}[/color] game-ticker-no-map-selected = [color=yellow]Map not yet selected![/color] game-ticker-player-no-jobs-available-when-joining = When attempting to join to the game, no jobs were available.