Skip to content

Commit

Permalink
Remove TickerLobbyReadyEvent (space-wizards#17522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr authored Jun 24, 2023
1 parent 694ba69 commit ecae023
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 41 deletions.
7 changes: 0 additions & 7 deletions Content.Client/GameTicking/Managers/ClientGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public sealed class ClientGameTicker : SharedGameTicker

public event Action? InfoBlobUpdated;
public event Action? LobbyStatusUpdated;
public event Action? LobbyReadyUpdated;
public event Action? LobbyLateJoinStatusUpdated;
public event Action<IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated;

Expand All @@ -62,7 +61,6 @@ public override void Initialize()
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
SubscribeNetworkEvent<TickerLobbyReadyEvent>(LobbyReady);
SubscribeNetworkEvent<RoundEndMessageEvent>(RoundEnd);
SubscribeNetworkEvent<RequestWindowAttentionEvent>(msg =>
{
Expand Down Expand Up @@ -124,11 +122,6 @@ private void LobbyCountdown(TickerLobbyCountdownEvent message)
Paused = message.Paused;
}

private void LobbyReady(TickerLobbyReadyEvent message)
{
LobbyReadyUpdated?.Invoke();
}

private void RoundEnd(RoundEndMessageEvent message)
{
if (message.LobbySong != null)
Expand Down
18 changes: 0 additions & 18 deletions Content.Server/GameTicking/GameTicker.Lobby.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,6 @@ private string GetInfoText()
("roundId", RoundId), ("playerCount", playerCount), ("readyCount", readyCount), ("mapName", stationNames.ToString()),("gmTitle", gmTitle),("desc", desc));
}

private TickerLobbyReadyEvent GetStatusSingle(ICommonSession player, PlayerGameStatus gameStatus)
{
return new (new Dictionary<NetUserId, PlayerGameStatus> { { player.UserId, gameStatus } });
}

private TickerLobbyReadyEvent GetPlayerStatus()
{
var players = new Dictionary<NetUserId, PlayerGameStatus>();
foreach (var player in _playerGameStatuses.Keys)
{
_playerGameStatuses.TryGetValue(player, out var status);
players.Add(player, status);
}
return new TickerLobbyReadyEvent(players);
}

private TickerLobbyStatusEvent GetStatusMsg(IPlayerSession session)
{
_playerGameStatuses.TryGetValue(session.UserId, out var status);
Expand Down Expand Up @@ -160,7 +144,6 @@ public void ToggleReadyAll(bool ready)
if (!_playerManager.TryGetSessionById(playerUserId, out var playerSession))
continue;
RaiseNetworkEvent(GetStatusMsg(playerSession), playerSession.ConnectedClient);
RaiseNetworkEvent(GetStatusSingle(playerSession, status));
}
}

Expand All @@ -180,7 +163,6 @@ public void ToggleReady(IPlayerSession player, bool ready)
var status = ready ? PlayerGameStatus.ReadyToPlay : PlayerGameStatus.NotReadyToPlay;
_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();
}
Expand Down
1 change: 0 additions & 1 deletion Content.Server/GameTicking/GameTicker.Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ private void PlayerJoinLobby(IPlayerSession session)
RaiseNetworkEvent(new TickerJoinLobbyEvent(), client);
RaiseNetworkEvent(GetStatusMsg(session), client);
RaiseNetworkEvent(GetInfoMsg(), client);
RaiseNetworkEvent(GetPlayerStatus(), client);
RaiseLocalEvent(new PlayerJoinedLobbyEvent(session));
}

Expand Down
1 change: 0 additions & 1 deletion Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ public void JoinAsObserver(IPlayerSession player)

PlayerJoinGame(player);
SpawnObserver(player);
RaiseNetworkEvent(GetStatusSingle(player, PlayerGameStatus.JoinedGame));
}

/// <summary>
Expand Down
14 changes: 0 additions & 14 deletions Content.Shared/GameTicking/SharedGameTicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,6 @@ public TickerLobbyCountdownEvent(TimeSpan startTime, bool paused)
}
}

[Serializable, NetSerializable]
public sealed class TickerLobbyReadyEvent : EntityEventArgs
{
/// <summary>
/// The Status of the Player in the lobby (ready, observer, ...)
/// </summary>
public Dictionary<NetUserId, PlayerGameStatus> Status { get; }

public TickerLobbyReadyEvent(Dictionary<NetUserId, PlayerGameStatus> status)
{
Status = status;
}
}

[Serializable, NetSerializable]
public sealed class TickerJobsAvailableEvent : EntityEventArgs
{
Expand Down

0 comments on commit ecae023

Please sign in to comment.