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>
This commit is contained in:
theashtronaut
2022-11-08 20:02:07 +00:00
committed by GitHub
parent 8835a50342
commit 728c395bda
3 changed files with 18 additions and 3 deletions

View File

@@ -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();
}
}
}

View File

@@ -243,6 +243,7 @@ namespace Content.Server.GameTicking
ReqWindowAttentionAll();
UpdateLateJoinStatus();
AnnounceRound();
UpdateInfoText();
#if EXCEPTION_TOLERANCE
}

View File

@@ -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.