Un-revert IPlayerManager refactor (#21244)

This commit is contained in:
Leon Friedrich
2023-10-28 09:59:53 +11:00
committed by GitHub
parent c55e1dcafd
commit e685cb626b
245 changed files with 781 additions and 943 deletions

View File

@@ -12,7 +12,6 @@ using Content.Shared.Preferences;
using JetBrains.Annotations;
using Prometheus;
using Robust.Server.Maps;
using Robust.Server.Player;
using Robust.Shared.Asynchronous;
using Robust.Shared.Audio;
using Robust.Shared.Map;
@@ -205,7 +204,7 @@ namespace Content.Server.GameTicking
var startingEvent = new RoundStartingEvent(RoundId);
RaiseLocalEvent(startingEvent);
var readyPlayers = new List<IPlayerSession>();
var readyPlayers = new List<ICommonSession>();
var readyPlayerProfiles = new Dictionary<NetUserId, HumanoidCharacterProfile>();
foreach (var (userId, status) in _playerGameStatuses)
@@ -344,7 +343,7 @@ namespace Content.Server.GameTicking
{
connected = true;
}
PlayerData? contentPlayerData = null;
ContentPlayerData? contentPlayerData = null;
if (userId != null && _playerManager.TryGetPlayerData(userId.Value, out var playerData))
{
contentPlayerData = playerData.ContentData();
@@ -493,7 +492,7 @@ namespace Content.Server.GameTicking
private void ResettingCleanup()
{
// Move everybody currently in the server to lobby.
foreach (var player in _playerManager.ServerSessions)
foreach (var player in _playerManager.Sessions)
{
PlayerJoinLobby(player);
}
@@ -541,7 +540,7 @@ namespace Content.Server.GameTicking
DisallowLateJoin = false;
_playerGameStatuses.Clear();
foreach (var session in _playerManager.ServerSessions)
foreach (var session in _playerManager.Sessions)
{
_playerGameStatuses[session.UserId] = LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay;
}
@@ -735,10 +734,10 @@ namespace Content.Server.GameTicking
/// </summary>
public sealed class RoundStartAttemptEvent : CancellableEntityEventArgs
{
public IPlayerSession[] Players { get; }
public ICommonSession[] Players { get; }
public bool Forced { get; }
public RoundStartAttemptEvent(IPlayerSession[] players, bool forced)
public RoundStartAttemptEvent(ICommonSession[] players, bool forced)
{
Players = players;
Forced = forced;
@@ -757,11 +756,11 @@ namespace Content.Server.GameTicking
/// If you want to handle a specific player being spawned, remove it from this list and do what you need.
/// </summary>
/// <remarks>If you spawn a player by yourself from this event, don't forget to call <see cref="GameTicker.PlayerJoinGame"/> on them.</remarks>
public List<IPlayerSession> PlayerPool { get; }
public List<ICommonSession> PlayerPool { get; }
public IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> Profiles { get; }
public bool Forced { get; }
public RulePlayerSpawningEvent(List<IPlayerSession> playerPool, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, bool forced)
public RulePlayerSpawningEvent(List<ICommonSession> playerPool, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, bool forced)
{
PlayerPool = playerPool;
Profiles = profiles;
@@ -775,11 +774,11 @@ namespace Content.Server.GameTicking
/// </summary>
public sealed class RulePlayerJobsAssignedEvent
{
public IPlayerSession[] Players { get; }
public ICommonSession[] Players { get; }
public IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> Profiles { get; }
public bool Forced { get; }
public RulePlayerJobsAssignedEvent(IPlayerSession[] players, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, bool forced)
public RulePlayerJobsAssignedEvent(ICommonSession[] players, IReadOnlyDictionary<NetUserId, HumanoidCharacterProfile> profiles, bool forced)
{
Players = players;
Profiles = profiles;