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

@@ -1,5 +1,5 @@
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Administration
{
@@ -8,7 +8,7 @@ namespace Content.Server.Administration
/// </summary>
public sealed class AdminPermsChangedEventArgs : EventArgs
{
public AdminPermsChangedEventArgs(IPlayerSession player, AdminFlags? flags)
public AdminPermsChangedEventArgs(ICommonSession player, AdminFlags? flags)
{
Player = player;
Flags = flags;
@@ -17,7 +17,7 @@ namespace Content.Server.Administration
/// <summary>
/// The player that had their admin permissions changed.
/// </summary>
public IPlayerSession Player { get; }
public ICommonSession Player { get; }
/// <summary>
/// The admin flags of the player. Null if the player is no longer an admin.

View File

@@ -2,7 +2,6 @@
using Content.Shared.Administration;
using Content.Shared.Ghost;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -18,7 +17,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("Nah");

View File

@@ -2,7 +2,6 @@
using Content.Server.Administration.Managers;
using Content.Server.Afk;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Utility;
@@ -35,7 +34,7 @@ public sealed class AdminWhoCommand : IConsoleCommand
if (adminData.Title is { } title)
sb.Append($": [{title}]");
if (shell.Player is IPlayerSession player && adminMgr.HasAdminFlag(player, AdminFlags.Admin))
if (shell.Player is { } player && adminMgr.HasAdminFlag(player, AdminFlags.Admin))
{
if (afk.IsAfk(admin))
sb.Append(" [AFK]");

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration.UI;
using Content.Server.EUI;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -17,7 +16,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("This does not work from the server console.");

View File

@@ -1,15 +1,8 @@
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using Content.Server.Administration.Managers;
using Content.Server.Administration.Notes;
using Content.Server.Database;
using Content.Server.GameTicking;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Database;
using Content.Shared.Players.PlayTimeTracking;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
@@ -84,7 +77,7 @@ public sealed class BanCommand : LocalizedCommands
}
var located = await _locator.LookupIdByNameOrIdAsync(target);
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (located == null)
{
@@ -102,7 +95,7 @@ public sealed class BanCommand : LocalizedCommands
{
if (args.Length == 1)
{
var options = _playerManager.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
var options = _playerManager.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
return CompletionResult.FromHintOptions(options, LocalizationManager.GetString("cmd-ban-hint"));
}

View File

@@ -36,7 +36,7 @@ public sealed class BanListCommand : LocalizedCommands
return;
}
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
var bans = await _dbManager.GetServerBansAsync(data.LastAddress, data.UserId, data.LastHWId, false);
@@ -67,7 +67,7 @@ public sealed class BanListCommand : LocalizedCommands
return CompletionResult.Empty;
var playerMgr = IoCManager.Resolve<IPlayerManager>();
var options = playerMgr.ServerSessions.Select(c => c.Name).OrderBy(c => c).ToArray();
var options = playerMgr.Sessions.Select(c => c.Name).OrderBy(c => c).ToArray();
return CompletionResult.FromHintOptions(options, Loc.GetString("cmd-banlist-hint"));
}
}

View File

@@ -1,12 +1,6 @@
using Content.Shared.Administration;
using Robust.Shared.Console;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Content.Server.EUI;
using Robust.Server.Player;
namespace Content.Server.Administration.Commands;
@@ -21,7 +15,7 @@ public sealed class BanPanelCommand : LocalizedCommands
public override async void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("cmd-banpanel-server"));
return;

View File

@@ -1,6 +1,5 @@
using Content.Server.Mind;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -16,7 +15,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteLine("shell-server-cannot");
return;

View File

@@ -1,7 +1,5 @@
using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -17,7 +15,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("shell-only-players-can-run-this-command");

View File

@@ -1,10 +1,8 @@
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[UsedImplicitly]
@@ -17,7 +15,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("You cannot use this command from the server console.");

View File

@@ -3,7 +3,6 @@ using Content.Server.EUI;
using Content.Server.Explosion.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Explosion;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
@@ -21,7 +20,7 @@ public sealed class OpenExplosionEui : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteError("This does not work from the server console.");

View File

@@ -1,7 +1,6 @@
using Content.Server.EUI;
using Content.Server.Fax.AdminUI;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
@@ -16,7 +15,7 @@ public sealed class FaxUiCommand : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("shell-only-players-can-run-this-command");

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration.Logs;
using Content.Server.EUI;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
@@ -15,7 +14,7 @@ public sealed class OpenAdminLogsCommand : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteLine("This does not work from the server console.");
return;

View File

@@ -1,7 +1,5 @@
using Content.Server.Administration.Notes;
using Content.Server.Database;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands;
@@ -17,7 +15,7 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand
public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This does not work from the server console.");
return;

View File

@@ -1,10 +1,8 @@
using Content.Server.Administration.UI;
using Content.Server.EUI;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Permissions)]
@@ -16,7 +14,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("This does not work from the server console.");

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration.Notes;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
@@ -27,7 +26,7 @@ public sealed class OpenUserVisibleNotesCommand : IConsoleCommand
return;
}
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This does not work from the server console.");
return;

View File

@@ -1,7 +1,6 @@
using System.Text;
using Content.Server.Database;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -15,7 +14,7 @@ namespace Content.Server.Administration.Commands
public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
var dbMan = IoCManager.Resolve<IServerDbManager>();
if (args.Length != 1)

View File

@@ -6,7 +6,6 @@ using Robust.Shared.Audio;
using Robust.Shared.Console;
using Robust.Shared.ContentPack;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Commands;

View File

@@ -1,9 +1,7 @@
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[AnyCommand]
@@ -15,7 +13,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("You cannot use this command from the server console.");

View File

@@ -1,8 +1,6 @@
using Content.Server.Database;
using Content.Server.Preferences.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -16,7 +14,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (!(shell.Player is IPlayerSession))
if (shell.Player == null)
{
shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
return;

View File

@@ -2,6 +2,7 @@ using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Players;
using Robust.Server.Player;
using Robust.Shared.Console;

View File

@@ -10,7 +10,6 @@ using Content.Shared.PDA;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
@@ -57,7 +56,7 @@ namespace Content.Server.Administration.Commands
if (args.Length == 1)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError(Loc.GetString("set-outfit-command-is-not-player-error"));
return;

View File

@@ -4,11 +4,9 @@ using Content.Server.Warps;
using Content.Shared.Administration;
using Content.Shared.Follower;
using Content.Shared.Ghost;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
@@ -28,7 +26,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("Only players can use this command");

View File

@@ -1,8 +1,8 @@
using Content.Server.Database;
using Content.Shared.CCVar;
using Robust.Server.Player;
using Robust.Server.Upload;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
using Robust.Shared.Upload;
namespace Content.Server.Administration;
@@ -22,7 +22,7 @@ public sealed class ContentNetworkResourceManager
_netRes.OnResourceUploaded += OnUploadResource;
}
private async void OnUploadResource(IPlayerSession session, NetworkResourceUploadMessage msg)
private async void OnUploadResource(ICommonSession session, NetworkResourceUploadMessage msg)
{
if (StoreUploaded)
await _serverDb.AddUploadedResourceLogAsync(session.UserId, DateTime.Now, msg.RelativePath.ToString(), msg.Data);

View File

@@ -3,8 +3,8 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using Content.Server.Administration.Logs.Converters;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Player;
namespace Content.Server.Administration.Logs;
@@ -44,7 +44,7 @@ public sealed partial class AdminLogManager
var value = properties[key];
value = value switch
{
IPlayerSession player => new SerializablePlayer(player),
ICommonSession player => new SerializablePlayer(player),
EntityCoordinates entityCoordinates => new SerializableEntityCoordinates(_entityManager, entityCoordinates),
_ => value
};
@@ -56,7 +56,7 @@ public sealed partial class AdminLogManager
{
EntityUid id => id,
EntityStringRepresentation rep => rep.Uid,
IPlayerSession {AttachedEntity: {Valid: true}} session => session.AttachedEntity,
ICommonSession {AttachedEntity: {Valid: true}} session => session.AttachedEntity,
IComponent component => component.Owner,
_ => null
};

View File

@@ -1,5 +1,5 @@
using System.Text.Json;
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Administration.Logs.Converters;
@@ -36,9 +36,9 @@ public sealed class PlayerSessionConverter : AdminLogConverter<SerializablePlaye
public readonly struct SerializablePlayer
{
public readonly IPlayerSession Player;
public readonly ICommonSession Player;
public SerializablePlayer(IPlayerSession player)
public SerializablePlayer(ICommonSession player)
{
Player = player;
}

View File

@@ -7,15 +7,15 @@ using Content.Server.Database;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Players;
using Robust.Server.Console;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.ContentPack;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Errors;
using Robust.Shared.Utility;
@@ -35,16 +35,16 @@ namespace Content.Server.Administration.Managers
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly ToolshedManager _toolshed = default!;
private readonly Dictionary<IPlayerSession, AdminReg> _admins = new();
private readonly Dictionary<ICommonSession, AdminReg> _admins = new();
private readonly HashSet<NetUserId> _promotedPlayers = new();
public event Action<AdminPermsChangedEventArgs>? OnPermsChanged;
public IEnumerable<IPlayerSession> ActiveAdmins => _admins
public IEnumerable<ICommonSession> ActiveAdmins => _admins
.Where(p => p.Value.Data.Active)
.Select(p => p.Key);
public IEnumerable<IPlayerSession> AllAdmins => _admins.Select(p => p.Key);
public IEnumerable<ICommonSession> AllAdmins => _admins.Select(p => p.Key);
private readonly AdminCommandPermissions _commandPermissions = new();
private readonly AdminCommandPermissions _toolshedCommandPermissions = new();
@@ -56,7 +56,7 @@ namespace Content.Server.Administration.Managers
public AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false)
{
if (_admins.TryGetValue((IPlayerSession)session, out var reg) && (reg.Data.Active || includeDeAdmin))
if (_admins.TryGetValue(session, out var reg) && (reg.Data.Active || includeDeAdmin))
{
return reg.Data;
}
@@ -66,13 +66,13 @@ namespace Content.Server.Administration.Managers
public AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false)
{
if (_playerManager.TryGetSessionByEntity(uid, out var session) && session is IPlayerSession playerSession)
return GetAdminData(playerSession, includeDeAdmin);
if (_playerManager.TryGetSessionByEntity(uid, out var session))
return GetAdminData(session, includeDeAdmin);
return null;
}
public void DeAdmin(IPlayerSession session)
public void DeAdmin(ICommonSession session)
{
if (!_admins.TryGetValue(session, out var reg))
{
@@ -95,7 +95,7 @@ namespace Content.Server.Administration.Managers
UpdateAdminStatus(session);
}
public void ReAdmin(IPlayerSession session)
public void ReAdmin(ICommonSession session)
{
if (!_admins.TryGetValue(session, out var reg))
{
@@ -119,7 +119,7 @@ namespace Content.Server.Administration.Managers
UpdateAdminStatus(session);
}
public async void ReloadAdmin(IPlayerSession player)
public async void ReloadAdmin(ICommonSession player)
{
var data = await LoadAdminData(player);
var curAdmin = _admins.GetValueOrDefault(player);
@@ -236,7 +236,7 @@ namespace Content.Server.Administration.Managers
_toolshed.ActivePermissionController = this;
}
public void PromoteHost(IPlayerSession player)
public void PromoteHost(ICommonSession player)
{
_promotedPlayers.Add(player.UserId);
@@ -250,7 +250,7 @@ namespace Content.Server.Administration.Managers
}
// NOTE: Also sends commands list for non admins..
private void UpdateAdminStatus(IPlayerSession session)
private void UpdateAdminStatus(ICommonSession session)
{
var msg = new MsgUpdateAdminStatus();
@@ -290,7 +290,7 @@ namespace Content.Server.Administration.Managers
}
}
private async void LoginAdminMaybe(IPlayerSession session)
private async void LoginAdminMaybe(ICommonSession session)
{
var adminDat = await LoadAdminData(session);
if (adminDat == null)
@@ -323,7 +323,7 @@ namespace Content.Server.Administration.Managers
UpdateAdminStatus(session);
}
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(IPlayerSession session)
private async Task<(AdminData dat, int? rankId, bool specialLogin)?> LoadAdminData(ICommonSession session)
{
var promoteHost = IsLocal(session) && _cfg.GetCVar(CCVars.ConsoleLoginLocal)
|| _promotedPlayers.Contains(session.UserId)
@@ -387,7 +387,7 @@ namespace Content.Server.Administration.Managers
}
}
private static bool IsLocal(IPlayerSession player)
private static bool IsLocal(ICommonSession player)
{
var ep = player.ConnectedClient.RemoteEndPoint;
var addr = ep.Address;
@@ -419,7 +419,7 @@ namespace Content.Server.Administration.Managers
return false;
}
public bool CanCommand(IPlayerSession session, string cmdName)
public bool CanCommand(ICommonSession session, string cmdName)
{
if (_commandPermissions.AnyCommands.Contains(cmdName))
{
@@ -474,7 +474,7 @@ namespace Content.Server.Administration.Managers
return true;
}
var data = GetAdminData((IPlayerSession)user);
var data = GetAdminData(user);
if (data == null)
{
// Player isn't an admin.
@@ -520,32 +520,32 @@ namespace Content.Server.Administration.Managers
return (attribs.Length != 0, attribs);
}
public bool CanViewVar(IPlayerSession session)
public bool CanViewVar(ICommonSession session)
{
return CanCommand(session, "vv");
}
public bool CanAdminPlace(IPlayerSession session)
public bool CanAdminPlace(ICommonSession session)
{
return GetAdminData(session)?.CanAdminPlace() ?? false;
}
public bool CanScript(IPlayerSession session)
public bool CanScript(ICommonSession session)
{
return GetAdminData(session)?.CanScript() ?? false;
}
public bool CanAdminMenu(IPlayerSession session)
public bool CanAdminMenu(ICommonSession session)
{
return GetAdminData(session)?.CanAdminMenu() ?? false;
}
public bool CanAdminReloadPrototypes(IPlayerSession session)
public bool CanAdminReloadPrototypes(ICommonSession session)
{
return GetAdminData(session)?.CanAdminReloadPrototypes() ?? false;
}
private void SendPermsChangedEvent(IPlayerSession session)
private void SendPermsChangedEvent(ICommonSession session)
{
var flags = GetAdminData(session)?.Flags;
OnPermsChanged?.Invoke(new AdminPermsChangedEventArgs(session, flags));
@@ -553,7 +553,7 @@ namespace Content.Server.Administration.Managers
private sealed class AdminReg
{
public readonly IPlayerSession Session;
public readonly ICommonSession Session;
public AdminData Data;
public int? RankId;
@@ -561,7 +561,7 @@ namespace Content.Server.Administration.Managers
// Such as console.loginlocal or promotehost
public bool IsSpecialLogin;
public AdminReg(IPlayerSession session, AdminData data)
public AdminReg(ICommonSession session, AdminData data)
{
Data = data;
Session = session;

View File

@@ -15,6 +15,7 @@ using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -283,7 +284,7 @@ public sealed class BanManager : IBanManager, IPostInjectInit
SendRoleBans(player);
}
public void SendRoleBans(IPlayerSession pSession)
public void SendRoleBans(ICommonSession pSession)
{
var roleBans = _cachedRoleBans.GetValueOrDefault(pSession.UserId) ?? new HashSet<ServerRoleBanDef>();
var bans = new MsgRoleBans()

View File

@@ -1,9 +1,8 @@
using Content.Shared.Administration;
using Content.Shared.Administration.Managers;
using Robust.Server.Player;
using Robust.Shared.Player;
using Robust.Shared.Toolshed;
namespace Content.Server.Administration.Managers
{
/// <summary>
@@ -22,12 +21,12 @@ namespace Content.Server.Administration.Managers
/// <remarks>
/// This does not include admins that are de-adminned.
/// </remarks>
IEnumerable<IPlayerSession> ActiveAdmins { get; }
IEnumerable<ICommonSession> ActiveAdmins { get; }
/// <summary>
/// Gets all admins currently on the server, even de-adminned ones.
/// </summary>
IEnumerable<IPlayerSession> AllAdmins { get; }
IEnumerable<ICommonSession> AllAdmins { get; }
/// <summary>
/// De-admins an admin temporarily so they are effectively a normal player.
@@ -35,18 +34,18 @@ namespace Content.Server.Administration.Managers
/// <remarks>
/// De-adminned admins are able to re-admin at any time if they so desire.
/// </remarks>
void DeAdmin(IPlayerSession session);
void DeAdmin(ICommonSession session);
/// <summary>
/// Re-admins a de-adminned admin.
/// </summary>
void ReAdmin(IPlayerSession session);
void ReAdmin(ICommonSession session);
/// <summary>
/// Re-loads the permissions of an player in case their admin data changed DB-side.
/// </summary>
/// <seealso cref="ReloadAdminsWithRank"/>
void ReloadAdmin(IPlayerSession player);
void ReloadAdmin(ICommonSession player);
/// <summary>
/// Reloads admin permissions for all admins with a certain rank.
@@ -57,7 +56,7 @@ namespace Content.Server.Administration.Managers
void Initialize();
void PromoteHost(IPlayerSession player);
void PromoteHost(ICommonSession player);
bool TryGetCommandFlags(CommandSpec command, out AdminFlags[]? flags);
}

View File

@@ -2,8 +2,8 @@ using System.Collections.Immutable;
using System.Net;
using System.Threading.Tasks;
using Content.Shared.Database;
using Robust.Server.Player;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Server.Administration.Managers;
@@ -55,5 +55,5 @@ public interface IBanManager
/// Sends role bans to the target
/// </summary>
/// <param name="pSession">Player's session</param>
public void SendRoleBans(IPlayerSession pSession);
public void SendRoleBans(ICommonSession pSession);
}

View File

@@ -11,7 +11,7 @@ using Content.Shared.Database;
using Content.Shared.Players.PlayTimeTracking;
using Robust.Shared.Configuration;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
namespace Content.Server.Administration.Notes;

View File

@@ -1,13 +1,13 @@
using Content.Server.Administration.Commands;
using Content.Server.Chat.Managers;
using Content.Server.EUI;
using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server.Administration.Notes;

View File

@@ -2,7 +2,7 @@ using System.Threading.Tasks;
using Content.Server.Database;
using Content.Shared.Administration.Notes;
using Content.Shared.Database;
using Robust.Shared.Players;
using Robust.Shared.Player;
namespace Content.Server.Administration.Notes;

View File

@@ -1,6 +1,6 @@
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Administration;
@@ -16,7 +16,7 @@ public sealed partial class QuickDialogSystem
/// <param name="cancelAction">The action to execute upon the dialog being cancelled.</param>
/// <typeparam name="T1">Type of the input.</typeparam>
[PublicAPI]
public void OpenDialog<T1>(IPlayerSession session, string title, string prompt, Action<T1> okAction,
public void OpenDialog<T1>(ICommonSession session, string title, string prompt, Action<T1> okAction,
Action? cancelAction = null)
{
OpenDialogInternal(
@@ -53,7 +53,7 @@ public sealed partial class QuickDialogSystem
/// <typeparam name="T1">Type of the first input.</typeparam>
/// <typeparam name="T2">Type of the second input.</typeparam>
[PublicAPI]
public void OpenDialog<T1, T2>(IPlayerSession session, string title, string prompt1, string prompt2,
public void OpenDialog<T1, T2>(ICommonSession session, string title, string prompt1, string prompt2,
Action<T1, T2> okAction, Action? cancelAction = null)
{
OpenDialogInternal(
@@ -96,7 +96,7 @@ public sealed partial class QuickDialogSystem
/// <typeparam name="T2">Type of the second input.</typeparam>
/// <typeparam name="T3">Type of the third input.</typeparam>
[PublicAPI]
public void OpenDialog<T1, T2, T3>(IPlayerSession session, string title, string prompt1, string prompt2,
public void OpenDialog<T1, T2, T3>(ICommonSession session, string title, string prompt1, string prompt2,
string prompt3, Action<T1, T2, T3> okAction, Action? cancelAction = null)
{
OpenDialogInternal(
@@ -142,7 +142,7 @@ public sealed partial class QuickDialogSystem
/// <typeparam name="T3">Type of the third input.</typeparam>
/// <typeparam name="T4">Type of the fourth input.</typeparam>
[PublicAPI]
public void OpenDialog<T1, T2, T3, T4>(IPlayerSession session, string title, string prompt1, string prompt2,
public void OpenDialog<T1, T2, T3, T4>(ICommonSession session, string title, string prompt1, string prompt2,
string prompt3, string prompt4, Action<T1, T2, T3, T4> okAction, Action? cancelAction = null)
{
OpenDialogInternal(

View File

@@ -1,12 +1,9 @@
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Administration;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Serialization.TypeSerializers.Interfaces;
namespace Content.Server.Administration;
@@ -87,7 +84,7 @@ public sealed partial class QuickDialogSystem : EntitySystem
_openDialogsByUser.Remove(user);
}
private void OpenDialogInternal(IPlayerSession session, string title, List<QuickDialogEntry> entries, QuickDialogButtonFlag buttons, Action<QuickDialogResponseEvent> okAction, Action cancelAction)
private void OpenDialogInternal(ICommonSession session, string title, List<QuickDialogEntry> entries, QuickDialogButtonFlag buttons, Action<QuickDialogResponseEvent> okAction, Action cancelAction)
{
var did = GetDialogId();
RaiseNetworkEvent(

View File

@@ -109,7 +109,7 @@ namespace Content.Server.Administration.Systems
}
}
public void UpdatePlayerList(IPlayerSession player)
public void UpdatePlayerList(ICommonSession player)
{
_playerList[player.UserId] = GetPlayerInfo(player.Data, player);
@@ -203,7 +203,7 @@ namespace Content.Server.Administration.Systems
UpdatePanicBunker();
}
private void SendFullPlayerList(IPlayerSession playerSession)
private void SendFullPlayerList(ICommonSession playerSession)
{
var ev = new FullPlayerListEvent();
@@ -212,7 +212,7 @@ namespace Content.Server.Administration.Systems
RaiseNetworkEvent(ev, playerSession.ConnectedClient);
}
private PlayerInfo GetPlayerInfo(IPlayerData data, IPlayerSession? session)
private PlayerInfo GetPlayerInfo(SessionData data, ICommonSession? session)
{
var name = data.UserName;
var entityName = string.Empty;
@@ -326,7 +326,7 @@ namespace Content.Server.Administration.Systems
/// chat messages and showing a popup to other players.
/// Their items are dropped on the ground.
/// </summary>
public void Erase(IPlayerSession player)
public void Erase(ICommonSession player)
{
var entity = player.AttachedEntity;
_chat.DeleteMessagesBy(player);

View File

@@ -1,8 +1,8 @@
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Server.Administration.Systems;
@@ -20,7 +20,7 @@ public sealed class AdminTestArenaSystem : EntitySystem
public Dictionary<NetUserId, EntityUid> ArenaMap { get; private set; } = new();
public Dictionary<NetUserId, EntityUid?> ArenaGrid { get; private set; } = new();
public (EntityUid Map, EntityUid? Grid) AssertArenaLoaded(IPlayerSession admin)
public (EntityUid Map, EntityUid? Grid) AssertArenaLoaded(ICommonSession admin)
{
if (ArenaMap.TryGetValue(admin.UserId, out var arenaMap) && !Deleted(arenaMap) && !Terminating(arenaMap))
{

View File

@@ -24,11 +24,10 @@ using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Server.Console;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Toolshed;
@@ -427,7 +426,7 @@ namespace Content.Server.Administration.Systems
}
}
public void OpenEditSolutionsEui(IPlayerSession session, EntityUid uid)
public void OpenEditSolutionsEui(ICommonSession session, EntityUid uid)
{
if (session.AttachedEntity == null)
return;

View File

@@ -17,6 +17,7 @@ using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -119,7 +120,7 @@ namespace Content.Server.Administration.Systems
_typingUpdateTimestamps[args.SenderSession.UserId] = (_timing.RealTime, msg.Typing);
// Non-admins can only ever type on their own ahelp, guard against fake messages
var isAdmin = _adminManager.GetAdminData((IPlayerSession) args.SenderSession)?.HasFlag(AdminFlags.Adminhelp) ?? false;
var isAdmin = _adminManager.GetAdminData(args.SenderSession)?.HasFlag(AdminFlags.Adminhelp) ?? false;
var channel = isAdmin ? msg.Channel : args.SenderSession.UserId;
var update = new BwoinkPlayerTypingUpdated(channel, args.SenderSession.Name, msg.Typing);
@@ -376,7 +377,7 @@ namespace Content.Server.Administration.Systems
protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySessionEventArgs eventArgs)
{
base.OnBwoinkTextMessage(message, eventArgs);
var senderSession = (IPlayerSession) eventArgs.SenderSession;
var senderSession = eventArgs.SenderSession;
// TODO: Sanitize text?
// Confirm that this person is actually allowed to send a message here.

View File

@@ -1,6 +1,6 @@
using Content.Server.Administration.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Player;
using Robust.Shared.Toolshed;
namespace Content.Server.Administration.Toolshed;
@@ -11,13 +11,13 @@ public sealed class AdminsCommand : ToolshedCommand
[Dependency] private readonly IAdminManager _admin = default!;
[CommandImplementation("active")]
public IEnumerable<IPlayerSession> Active()
public IEnumerable<ICommonSession> Active()
{
return _admin.ActiveAdmins;
}
[CommandImplementation("all")]
public IEnumerable<IPlayerSession> All()
public IEnumerable<ICommonSession> All()
{
return _admin.AllAdmins;
}

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Server.Afk.Events;
using Content.Server.GameTicking;
using Content.Shared.CCVar;
@@ -24,7 +23,7 @@ public sealed class AFKSystem : EntitySystem
private float _checkDelay;
private TimeSpan _checkTime;
private readonly HashSet<IPlayerSession> _afkPlayers = new();
private readonly HashSet<ICommonSession> _afkPlayers = new();
public override void Initialize()
{
@@ -73,11 +72,9 @@ public sealed class AFKSystem : EntitySystem
_checkTime = _timing.CurTime + TimeSpan.FromSeconds(_checkDelay);
foreach (var session in Filter.GetAllPlayers())
foreach (var pSession in Filter.GetAllPlayers())
{
if (session.Status != SessionStatus.InGame) continue;
var pSession = (IPlayerSession) session;
if (pSession.Status != SessionStatus.InGame) continue;
var isAfk = _afkManager.IsAfk(pSession);
if (isAfk && _afkPlayers.Add(pSession))

View File

@@ -5,6 +5,7 @@ using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Enums;
using Robust.Shared.Input;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server.Afk
@@ -20,13 +21,13 @@ namespace Content.Server.Afk
/// </summary>
/// <param name="player">The player to check.</param>
/// <returns>True if the player is AFK, false otherwise.</returns>
bool IsAfk(IPlayerSession player);
bool IsAfk(ICommonSession player);
/// <summary>
/// Resets AFK status for the player as if they just did an action and are definitely not AFK.
/// </summary>
/// <param name="player">The player to set AFK status for.</param>
void PlayerDidAction(IPlayerSession player);
void PlayerDidAction(ICommonSession player);
void Initialize();
}
@@ -40,7 +41,7 @@ namespace Content.Server.Afk
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IConsoleHost _consoleHost = default!;
private readonly Dictionary<IPlayerSession, TimeSpan> _lastActionTimes = new();
private readonly Dictionary<ICommonSession, TimeSpan> _lastActionTimes = new();
public void Initialize()
{
@@ -55,7 +56,7 @@ namespace Content.Server.Afk
HandleInputCmd);
}
public void PlayerDidAction(IPlayerSession player)
public void PlayerDidAction(ICommonSession player)
{
if (player.Status == SessionStatus.Disconnected)
// Make sure we don't re-add to the dictionary if the player is disconnected now.
@@ -64,7 +65,7 @@ namespace Content.Server.Afk
_lastActionTimes[player] = _gameTiming.RealTime;
}
public bool IsAfk(IPlayerSession player)
public bool IsAfk(ICommonSession player)
{
if (!_lastActionTimes.TryGetValue(player, out var time))
// Some weird edge case like disconnected clients. Just say true I guess.
@@ -87,13 +88,13 @@ namespace Content.Server.Afk
private void ConsoleHostOnAnyCommandExecuted(IConsoleShell shell, string commandname, string argstr, string[] args)
{
if (shell.Player is IPlayerSession player)
if (shell.Player is { } player)
PlayerDidAction(player);
}
private void HandleInputCmd(FullInputCmdMessage msg, EntitySessionEventArgs args)
{
PlayerDidAction((IPlayerSession) args.SenderSession);
PlayerDidAction(args.SenderSession);
}
}
}

View File

@@ -1,4 +1,4 @@
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Afk.Events;
@@ -8,9 +8,9 @@ namespace Content.Server.Afk.Events;
[ByRefEvent]
public readonly struct AFKEvent
{
public readonly IPlayerSession Session;
public readonly ICommonSession Session;
public AFKEvent(IPlayerSession playerSession)
public AFKEvent(ICommonSession playerSession)
{
Session = playerSession;
}

View File

@@ -1,4 +1,4 @@
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Afk.Events;
@@ -8,9 +8,9 @@ namespace Content.Server.Afk.Events;
[ByRefEvent]
public readonly struct UnAFKEvent
{
public readonly IPlayerSession Session;
public readonly ICommonSession Session;
public UnAFKEvent(IPlayerSession playerSession)
public UnAFKEvent(ICommonSession playerSession)
{
Session = playerSession;
}

View File

@@ -2,7 +2,6 @@ using Content.Server.Administration;
using Content.Server.Commands;
using Content.Shared.Administration;
using Content.Shared.Alert;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Alert.Commands
@@ -16,7 +15,7 @@ namespace Content.Server.Alert.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player?.AttachedEntity == null)
{
shell.WriteLine("You don't have an entity.");

View File

@@ -2,7 +2,6 @@ using Content.Server.Administration;
using Content.Server.Commands;
using Content.Shared.Administration;
using Content.Shared.Alert;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Alert.Commands
@@ -16,7 +15,7 @@ namespace Content.Server.Alert.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player?.AttachedEntity == null)
{
shell.WriteLine("You cannot run this from the server or without an attached entity.");

View File

@@ -3,7 +3,6 @@ using Content.Server.Administration;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.AlertLevel.Commands
@@ -19,7 +18,7 @@ namespace Content.Server.AlertLevel.Commands
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
var levelNames = new string[] {};
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player?.AttachedEntity != null)
{
var stationUid = EntitySystem.Get<StationSystem>().GetOwningStation(player.AttachedEntity.Value);
@@ -54,7 +53,7 @@ namespace Content.Server.AlertLevel.Commands
return;
}
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player?.AttachedEntity == null)
{
shell.WriteLine(Loc.GetString("shell-only-players-can-run-this-command"));

View File

@@ -22,6 +22,7 @@ using Content.Server.Station.Systems;
using Content.Server.Shuttles.Systems;
using Content.Shared.Mobs;
using Robust.Server.Containers;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.Antag;
@@ -88,9 +89,9 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
out List<EntityUid> chosen,
bool includeHeads = false)
{
var allPlayers = _playerSystem.ServerSessions.ToList();
var playerList = new List<IPlayerSession>();
var prefList = new List<IPlayerSession>();
var allPlayers = _playerSystem.Sessions.ToList();
var playerList = new List<ICommonSession>();
var prefList = new List<ICommonSession>();
chosen = new List<EntityUid>();
foreach (var player in allPlayers)
{
@@ -116,7 +117,7 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
var antags = Math.Clamp(allPlayers.Count / antagsPerPlayer, 1, maxAntags);
for (var antag = 0; antag < antags; antag++)
{
IPlayerSession chosenPlayer = null!;
ICommonSession? chosenPlayer = null;
if (prefList.Count == 0)
{
if (playerList.Count == 0)

View File

@@ -1,6 +1,6 @@
using Content.Shared.Arcade;
using Robust.Server.Player;
using System.Linq;
using Robust.Shared.Player;
namespace Content.Server.Arcade.BlockGame;
@@ -166,7 +166,7 @@ public sealed partial class BlockGame
/// </summary>
/// <param name="message">The message to send to a specific player/spectator.</param>
/// <param name="session">The target recipient.</param>
private void SendMessage(BoundUserInterfaceMessage message, IPlayerSession session)
private void SendMessage(BoundUserInterfaceMessage message, ICommonSession session)
{
if (_uiSystem.TryGetUi(_owner, BlockGameUiKey.Key, out var bui))
_uiSystem.TrySendUiMessage(bui, message, session);
@@ -176,7 +176,7 @@ public sealed partial class BlockGame
/// Handles sending the current state of the game to a player that has just opened the UI.
/// </summary>
/// <param name="session">The target recipient.</param>
public void UpdateNewPlayerUI(IPlayerSession session)
public void UpdateNewPlayerUI(ICommonSession session)
{
if (_gameOver)
{
@@ -209,7 +209,7 @@ public sealed partial class BlockGame
/// Handles broadcasting the full player-visible game state to a specific player/spectator.
/// </summary>
/// <param name="session">The target recipient.</param>
private void FullUpdate(IPlayerSession session)
private void FullUpdate(ICommonSession session)
{
UpdateFieldUI(session);
SendNextPieceUpdate(session);
@@ -235,7 +235,7 @@ public sealed partial class BlockGame
/// Handles broadcasting the current location of all of the blocks in the playfield + the active piece to a specific player/spectator.
/// </summary>
/// <param name="session">The target recipient.</param>
public void UpdateFieldUI(IPlayerSession session)
public void UpdateFieldUI(ICommonSession session)
{
if (!Started)
return;
@@ -283,7 +283,7 @@ public sealed partial class BlockGame
/// Broadcasts the state of the next queued piece to a specific viewer.
/// </summary>
/// <param name="session">The target recipient.</param>
private void SendNextPieceUpdate(IPlayerSession session)
private void SendNextPieceUpdate(ICommonSession session)
{
SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(NextPiece.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.NextBlock), session);
}
@@ -303,7 +303,7 @@ public sealed partial class BlockGame
/// Broadcasts the state of the currently held piece to a specific viewer.
/// </summary>
/// <param name="session">The target recipient.</param>
private void SendHoldPieceUpdate(IPlayerSession session)
private void SendHoldPieceUpdate(ICommonSession session)
{
if (HeldPiece.HasValue)
SendMessage(new BlockGameMessages.BlockGameVisualUpdateMessage(HeldPiece.Value.BlocksForPreview(), BlockGameMessages.BlockGameVisualType.HoldBlock), session);
@@ -323,7 +323,7 @@ public sealed partial class BlockGame
/// Broadcasts the current game level to a specific viewer.
/// </summary>
/// <param name="session">The target recipient.</param>
private void SendLevelUpdate(IPlayerSession session)
private void SendLevelUpdate(ICommonSession session)
{
SendMessage(new BlockGameMessages.BlockGameLevelUpdateMessage(Level), session);
}
@@ -340,7 +340,7 @@ public sealed partial class BlockGame
/// Broadcasts the current game score to a specific viewer.
/// </summary>
/// <param name="session">The target recipient.</param>
private void SendPointsUpdate(IPlayerSession session)
private void SendPointsUpdate(ICommonSession session)
{
SendMessage(new BlockGameMessages.BlockGameScoreUpdateMessage(Points), session);
}
@@ -357,7 +357,7 @@ public sealed partial class BlockGame
/// Broadcasts the current game high score positions to a specific viewer.
/// </summary>
/// <param name="session">The target recipient.</param>
private void SendHighscoreUpdate(IPlayerSession session)
private void SendHighscoreUpdate(ICommonSession session)
{
SendMessage(new BlockGameMessages.BlockGameHighScoreUpdateMessage(_arcadeSystem.GetLocalHighscores(), _arcadeSystem.GetGlobalHighscores()), session);
}

View File

@@ -1,4 +1,4 @@
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Arcade.BlockGame;
@@ -13,10 +13,10 @@ public sealed partial class BlockGameArcadeComponent : Component
/// <summary>
/// The player currently playing the active session of NT-BG.
/// </summary>
public IPlayerSession? Player = null;
public ICommonSession? Player = null;
/// <summary>
/// The players currently viewing (but not playing) the active session of NT-BG.
/// </summary>
public readonly List<IPlayerSession> Spectators = new();
public readonly List<ICommonSession> Spectators = new();
}

View File

@@ -2,7 +2,7 @@ using Content.Server.Power.Components;
using Content.Server.UserInterface;
using Content.Shared.Arcade;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.Arcade.BlockGame;
@@ -30,7 +30,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem
}
}
private void UpdatePlayerStatus(EntityUid uid, IPlayerSession session, PlayerBoundUserInterface? bui = null, BlockGameArcadeComponent? blockGame = null)
private void UpdatePlayerStatus(EntityUid uid, ICommonSession session, PlayerBoundUserInterface? bui = null, BlockGameArcadeComponent? blockGame = null)
{
if (!Resolve(uid, ref blockGame))
return;
@@ -67,7 +67,7 @@ public sealed class BlockGameArcadeSystem : EntitySystem
private void OnAfterUiClose(EntityUid uid, BlockGameArcadeComponent component, BoundUIClosedEvent args)
{
if (args.Session is not IPlayerSession session)
if (args.Session is not { } session)
return;
if (component.Player != session)

View File

@@ -2,7 +2,6 @@ using Content.Server.Administration;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
@@ -20,7 +19,7 @@ namespace Content.Server.Atmos.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid? gridId;
Gas? gas = null;

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands
@@ -15,7 +14,7 @@ namespace Content.Server.Atmos.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("You must be a player to use this command.");

View File

@@ -10,6 +10,7 @@ using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
namespace Content.Server.Atmos.EntitySystems
{
@@ -27,7 +28,7 @@ namespace Content.Server.Atmos.EntitySystems
/// To modify it see <see cref="AddObserver"/> and
/// <see cref="RemoveObserver"/>.
/// </summary>
private readonly HashSet<IPlayerSession> _playerObservers = new();
private readonly HashSet<ICommonSession> _playerObservers = new();
/// <summary>
/// Overlay update ticks per second.
@@ -48,17 +49,17 @@ namespace Content.Server.Atmos.EntitySystems
_playerManager.PlayerStatusChanged -= OnPlayerStatusChanged;
}
public bool AddObserver(IPlayerSession observer)
public bool AddObserver(ICommonSession observer)
{
return _playerObservers.Add(observer);
}
public bool HasObserver(IPlayerSession observer)
public bool HasObserver(ICommonSession observer)
{
return _playerObservers.Contains(observer);
}
public bool RemoveObserver(IPlayerSession observer)
public bool RemoveObserver(ICommonSession observer)
{
if (!_playerObservers.Remove(observer))
{
@@ -76,7 +77,7 @@ namespace Content.Server.Atmos.EntitySystems
/// </summary>
/// <param name="observer">The observer to toggle.</param>
/// <returns>true if added, false if removed.</returns>
public bool ToggleObserver(IPlayerSession observer)
public bool ToggleObserver(ICommonSession observer)
{
if (HasObserver(observer))
{

View File

@@ -12,7 +12,6 @@ using Content.Shared.Toggleable;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Systems;
@@ -60,12 +59,6 @@ namespace Content.Server.Atmos.EntitySystems
private void OnGasTankToggleInternals(Entity<GasTankComponent> ent, ref GasTankToggleInternalsMessage args)
{
if (args.Session is not IPlayerSession playerSession ||
playerSession.AttachedEntity == null)
{
return;
}
ToggleInternals(ent);
}

View File

@@ -16,6 +16,7 @@ using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Threading;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -35,7 +36,7 @@ namespace Content.Server.Atmos.EntitySystems
[Robust.Shared.IoC.Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Robust.Shared.IoC.Dependency] private readonly ChunkingSystem _chunkingSys = default!;
private readonly Dictionary<IPlayerSession, Dictionary<NetEntity, HashSet<Vector2i>>> _lastSentChunks = new();
private readonly Dictionary<ICommonSession, Dictionary<NetEntity, HashSet<Vector2i>>> _lastSentChunks = new();
// Oh look its more duplicated decal system code!
private ObjectPool<HashSet<Vector2i>> _chunkIndexPool =
@@ -286,12 +287,12 @@ namespace Content.Server.Atmos.EntitySystems
// Now we'll go through each player, then through each chunk in range of that player checking if the player is still in range
// If they are, check if they need the new data to send (i.e. if there's an overlay for the gas).
// Afterwards we reset all the chunk data for the next time we tick.
var players = _playerManager.ServerSessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var players = _playerManager.Sessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var opts = new ParallelOptions { MaxDegreeOfParallelism = _parMan.ParallelProcessCount };
Parallel.ForEach(players, opts, p => UpdatePlayer(p, curTick));
}
private void UpdatePlayer(IPlayerSession playerSession, GameTick curTick)
private void UpdatePlayer(ICommonSession playerSession, GameTick curTick)
{
var chunksInRange = _chunkingSys.GetChunksForSession(playerSession, ChunkSize, _chunkIndexPool, _chunkViewerPool);
var previouslySent = _lastSentChunks[playerSession];

View File

@@ -4,7 +4,6 @@ using Content.Server.Body.Systems;
using Content.Shared.Administration;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -27,7 +26,7 @@ namespace Content.Server.Body.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid entity;
EntityUid hand;

View File

@@ -1,10 +1,8 @@
using System.Linq;
using Content.Server.Administration;
using Content.Server.Body.Systems;
using Content.Shared.Administration;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Body.Commands
@@ -20,7 +18,7 @@ namespace Content.Server.Body.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid bodyId;
EntityUid? partUid;

View File

@@ -2,7 +2,6 @@ using Content.Server.Administration;
using Content.Server.Body.Systems;
using Content.Shared.Administration;
using Content.Shared.Body.Components;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Random;
@@ -17,7 +16,7 @@ namespace Content.Server.Body.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("Only a player can run this command.");

View File

@@ -4,7 +4,6 @@ using Content.Server.Body.Systems;
using Content.Shared.Administration;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Random;
@@ -22,7 +21,7 @@ namespace Content.Server.Body.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("Only a player can run this command.");

View File

@@ -116,7 +116,7 @@ public sealed class BodySystem : SharedBodySystem
if (!Resolve(bodyId, ref body, false))
return new HashSet<EntityUid>();
if (LifeStage(bodyId) >= EntityLifeStage.Terminating || EntityManager.IsQueuedForDeletion(bodyId))
if (TerminatingOrDeleted(bodyId) || EntityManager.IsQueuedForDeletion(bodyId))
return new HashSet<EntityUid>();
var xform = Transform(bodyId);

View File

@@ -8,7 +8,7 @@ using Content.Shared.Cargo.Events;
using Content.Shared.Cargo.Prototypes;
using Content.Shared.Database;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

View File

@@ -6,9 +6,9 @@ using Content.Shared.CartridgeLoader;
using Content.Shared.Interaction;
using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Player;
namespace Content.Server.CartridgeLoader;
@@ -98,7 +98,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
/// and use this method to update its state so the cartridge loaders state can be added to it.
/// </remarks>
/// <seealso cref="PDA.PdaSystem.UpdatePdaUserInterface"/>
public void UpdateUiState(EntityUid loaderUid, IPlayerSession? session, CartridgeLoaderComponent? loader)
public void UpdateUiState(EntityUid loaderUid, ICommonSession? session, CartridgeLoaderComponent? loader)
{
if (!Resolve(loaderUid, ref loader))
return;
@@ -122,7 +122,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
/// This method is called "UpdateCartridgeUiState" but cartridges and a programs are the same. A cartridge is just a program as a visible item.
/// </remarks>
/// <seealso cref="Cartridges.NotekeeperCartridgeSystem.UpdateUiState"/>
public void UpdateCartridgeUiState(EntityUid loaderUid, BoundUserInterfaceState state, IPlayerSession? session = default!, CartridgeLoaderComponent? loader = default!)
public void UpdateCartridgeUiState(EntityUid loaderUid, BoundUserInterfaceState state, ICommonSession? session = default!, CartridgeLoaderComponent? loader = default!)
{
if (!Resolve(loaderUid, ref loader))
return;

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Chat.Commands
@@ -15,7 +14,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = (IPlayerSession?) shell.Player;
var player = shell.Player;
if (player == null)
{

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
@@ -15,7 +14,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
@@ -15,7 +14,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Chat.Commands
@@ -14,7 +13,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
@@ -15,7 +14,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;

View File

@@ -1,7 +1,6 @@
using Content.Server.GameTicking;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
@@ -18,7 +17,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteLine(Loc.GetString("shell-cannot-run-command-from-server"));
return;

View File

@@ -1,6 +1,5 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
@@ -15,7 +14,7 @@ namespace Content.Server.Chat.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;

View File

@@ -10,11 +10,9 @@ using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Database;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Replays;
using Robust.Shared.Utility;
@@ -51,8 +49,8 @@ namespace Content.Server.Chat.Managers
private bool _oocEnabled = true;
private bool _adminOocEnabled = true;
public Dictionary<IPlayerSession, int> SenderKeys { get; } = new();
public Dictionary<IPlayerSession, HashSet<NetEntity>> SenderEntities { get; } = new();
public Dictionary<ICommonSession, int> SenderKeys { get; } = new();
public Dictionary<ICommonSession, HashSet<NetEntity>> SenderEntities { get; } = new();
public void Initialize()
{
@@ -79,7 +77,7 @@ namespace Content.Server.Chat.Managers
DispatchServerAnnouncement(Loc.GetString(val ? "chat-manager-admin-ooc-chat-enabled-message" : "chat-manager-admin-ooc-chat-disabled-message"));
}
public void DeleteMessagesBy(IPlayerSession player)
public void DeleteMessagesBy(ICommonSession player)
{
var key = SenderKeys.GetValueOrDefault(player);
var entities = SenderEntities.GetValueOrDefault(player) ?? new HashSet<NetEntity>();
@@ -165,7 +163,7 @@ namespace Content.Server.Chat.Managers
/// <param name="player">The player sending the message.</param>
/// <param name="message">The message.</param>
/// <param name="type">The type of message.</param>
public void TrySendOOCMessage(IPlayerSession player, string message, OOCChatType type)
public void TrySendOOCMessage(ICommonSession player, string message, OOCChatType type)
{
// Check if message exceeds the character limit
if (message.Length > MaxMessageLength)
@@ -189,7 +187,7 @@ namespace Content.Server.Chat.Managers
#region Private API
private void SendOOC(IPlayerSession player, string message)
private void SendOOC(ICommonSession player, string message)
{
if (_adminManager.IsAdmin(player))
{
@@ -226,7 +224,7 @@ namespace Content.Server.Chat.Managers
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"OOC from {player:Player}: {message}");
}
private void SendAdminChat(IPlayerSession player, string message)
private void SendAdminChat(ICommonSession player, string message)
{
if (!_adminManager.IsAdmin(player))
{
@@ -326,7 +324,7 @@ namespace Content.Server.Chat.Managers
}
}
public bool MessageCharacterLimit(IPlayerSession? player, string message)
public bool MessageCharacterLimit(ICommonSession? player, string message)
{
var isOverLength = false;

View File

@@ -1,8 +1,6 @@
using Content.Shared.Chat;
using Robust.Server.Player;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Players;
namespace Content.Server.Chat.Managers
{
@@ -12,12 +10,12 @@ namespace Content.Server.Chat.Managers
/// Keys identifying messages sent by a specific player, used when sending
/// <see cref="MsgChatMessage"/>
/// </summary>
Dictionary<IPlayerSession, int> SenderKeys { get; }
Dictionary<ICommonSession, int> SenderKeys { get; }
/// <summary>
/// Tracks which entities a player was attached to while sending messages.
/// </summary>
Dictionary<IPlayerSession, HashSet<NetEntity>> SenderEntities { get; }
Dictionary<ICommonSession, HashSet<NetEntity>> SenderEntities { get; }
void Initialize();
@@ -30,7 +28,7 @@ namespace Content.Server.Chat.Managers
void DispatchServerMessage(ICommonSession player, string message, bool suppressLog = false);
void TrySendOOCMessage(IPlayerSession player, string message, OOCChatType type);
void TrySendOOCMessage(ICommonSession player, string message, OOCChatType type);
void SendHookOOC(string sender, string message);
void SendAdminAnnouncement(string message);
@@ -47,8 +45,8 @@ namespace Content.Server.Chat.Managers
void ChatMessageToAll(ChatChannel channel, string message, string wrappedMessage, EntityUid source, bool hideChat, bool recordReplay, Color? colorOverride = null, string? audioPath = null, float audioVolume = 0, int? senderKey = null);
bool MessageCharacterLimit(IPlayerSession player, string message);
bool MessageCharacterLimit(ICommonSession player, string message);
void DeleteMessagesBy(IPlayerSession player);
void DeleteMessagesBy(ICommonSession player);
}
}

View File

@@ -7,7 +7,6 @@ using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.GameTicking;
using Content.Server.Players;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.ActionBlocker;
@@ -18,6 +17,7 @@ using Content.Shared.Ghost;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Mobs.Systems;
using Content.Shared.Players;
using Content.Shared.Radio;
using Robust.Server.GameObjects;
using Robust.Server.Player;
@@ -26,7 +26,6 @@ using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Replays;
@@ -147,7 +146,7 @@ public sealed partial class ChatSystem : SharedChatSystem
InGameICChatType desiredType,
bool hideChat, bool hideLog = false,
IConsoleShell? shell = null,
IPlayerSession? player = null, string? nameOverride = null,
ICommonSession? player = null, string? nameOverride = null,
bool checkRadioPrefix = true,
bool ignoreActionBlocker = false)
{
@@ -172,7 +171,7 @@ public sealed partial class ChatSystem : SharedChatSystem
ChatTransmitRange range,
bool hideLog = false,
IConsoleShell? shell = null,
IPlayerSession? player = null,
ICommonSession? player = null,
string? nameOverride = null,
bool checkRadioPrefix = true,
bool ignoreActionBlocker = false
@@ -253,7 +252,7 @@ public sealed partial class ChatSystem : SharedChatSystem
InGameOOCChatType type,
bool hideChat,
IConsoleShell? shell = null,
IPlayerSession? player = null
ICommonSession? player = null
)
{
if (!CanSendInGame(message, shell, player))
@@ -547,7 +546,7 @@ public sealed partial class ChatSystem : SharedChatSystem
}
// ReSharper disable once InconsistentNaming
private void SendLOOC(EntityUid source, IPlayerSession player, string message, bool hideChat)
private void SendLOOC(EntityUid source, ICommonSession player, string message, bool hideChat)
{
var name = FormattedMessage.EscapeText(Identity.Name(source, EntityManager));
@@ -571,7 +570,7 @@ public sealed partial class ChatSystem : SharedChatSystem
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}");
}
private void SendDeadChat(EntityUid source, IPlayerSession player, string message, bool hideChat)
private void SendDeadChat(EntityUid source, ICommonSession player, string message, bool hideChat)
{
var clients = GetDeadChatClients();
var playerName = Name(source);
@@ -628,13 +627,13 @@ public sealed partial class ChatSystem : SharedChatSystem
initialResult = MessageRangeCheckResult.Full;
break;
case ChatTransmitRange.GhostRangeLimit:
initialResult = (data.Observer && data.Range < 0 && !_adminManager.IsAdmin((IPlayerSession) session)) ? MessageRangeCheckResult.HideChat : MessageRangeCheckResult.Full;
initialResult = (data.Observer && data.Range < 0 && !_adminManager.IsAdmin(session)) ? MessageRangeCheckResult.HideChat : MessageRangeCheckResult.Full;
break;
case ChatTransmitRange.HideChat:
initialResult = MessageRangeCheckResult.HideChat;
break;
case ChatTransmitRange.NoGhosts:
initialResult = (data.Observer && !_adminManager.IsAdmin((IPlayerSession) session)) ? MessageRangeCheckResult.Disallowed : MessageRangeCheckResult.Full;
initialResult = (data.Observer && !_adminManager.IsAdmin(session)) ? MessageRangeCheckResult.Disallowed : MessageRangeCheckResult.Full;
break;
}
var insistHideChat = data.HideChatOverride ?? false;
@@ -666,7 +665,7 @@ public sealed partial class ChatSystem : SharedChatSystem
/// <summary>
/// Returns true if the given player is 'allowed' to send the given message, false otherwise.
/// </summary>
private bool CanSendInGame(string message, IConsoleShell? shell = null, IPlayerSession? player = null)
private bool CanSendInGame(string message, IConsoleShell? shell = null, ICommonSession? player = null)
{
// Non-players don't have to worry about these restrictions.
if (player == null)
@@ -694,7 +693,7 @@ public sealed partial class ChatSystem : SharedChatSystem
{
var newMessage = message.Trim();
newMessage = SanitizeMessageReplaceWords(newMessage);
if (capitalize)
newMessage = SanitizeMessageCapital(newMessage);
if (capitalizeTheWordI)

View File

@@ -2,6 +2,7 @@
using Content.Shared.Chemistry.Reagent;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.EntitySystems;

View File

@@ -1,12 +1,12 @@
using System.Linq;
using Content.Shared.Decals;
using Microsoft.Extensions.ObjectPool;
using Robust.Server.Player;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Shared.Chunking;
@@ -41,7 +41,7 @@ public sealed class ChunkingSystem : EntitySystem
private void OnPvsRangeChanged(float value) => _baseViewBounds = Box2.UnitCentered.Scale(value);
public Dictionary<NetEntity, HashSet<Vector2i>> GetChunksForSession(
IPlayerSession session,
ICommonSession session,
int chunkSize,
ObjectPool<HashSet<Vector2i>> indexPool,
ObjectPool<Dictionary<NetEntity, HashSet<Vector2i>>> viewerPool,
@@ -52,7 +52,7 @@ public sealed class ChunkingSystem : EntitySystem
return chunks;
}
private HashSet<EntityUid> GetSessionViewers(IPlayerSession session)
private HashSet<EntityUid> GetSessionViewers(ICommonSession session)
{
var viewers = new HashSet<EntityUid>();
if (session.Status != SessionStatus.InGame || session.AttachedEntity is null)

View File

@@ -3,6 +3,7 @@ using System.Globalization;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Network;
using Robust.Shared.Player;
namespace Content.Server.Commands
{
@@ -16,7 +17,7 @@ namespace Content.Server.Commands
/// sending a failure to the performer if unable to.
/// </summary>
public static bool TryGetSessionByUsernameOrId(IConsoleShell shell,
string usernameOrId, IPlayerSession performer, [NotNullWhen(true)] out IPlayerSession? session)
string usernameOrId, ICommonSession performer, [NotNullWhen(true)] out ICommonSession? session)
{
var plyMgr = IoCManager.Resolve<IPlayerManager>();
if (plyMgr.TryGetSessionByUsername(usernameOrId, out session)) return true;
@@ -36,7 +37,7 @@ namespace Content.Server.Commands
/// sending a failure to the performer if unable to.
/// </summary>
public static bool TryGetAttachedEntityByUsernameOrId(IConsoleShell shell,
string usernameOrId, IPlayerSession performer, out EntityUid attachedEntity)
string usernameOrId, ICommonSession performer, out EntityUid attachedEntity)
{
attachedEntity = default;
if (!TryGetSessionByUsernameOrId(shell, usernameOrId, performer, out var session)) return false;
@@ -67,7 +68,7 @@ namespace Content.Server.Commands
transform.LocalPosition.Y.ToString(CultureInfo.InvariantCulture));
ruleString = ruleString.Replace("$NAME", entMan.GetComponent<MetaDataComponent>(ent).EntityName);
if (shell.Player is IPlayerSession player)
if (shell.Player is { } player)
{
if (player.AttachedEntity is {Valid: true} p)
{

View File

@@ -3,7 +3,6 @@ using Content.Server.Power.Components;
using Content.Shared.Administration;
using Content.Shared.Construction;
using Content.Shared.Tag;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map.Components;
@@ -21,7 +20,7 @@ namespace Content.Server.Construction.Commands
public void Execute(IConsoleShell shell, string argsOther, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid? gridId;
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();

View File

@@ -1,6 +1,5 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -20,7 +19,7 @@ sealed class TileReplaceCommand : IConsoleCommand
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid? gridId;
string tileIdA;
string tileIdB;

View File

@@ -2,10 +2,9 @@ using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Maps;
using Content.Shared.Tag;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
namespace Content.Server.Construction.Commands
@@ -29,7 +28,7 @@ namespace Content.Server.Construction.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid? gridId;
switch (args.Length)

View File

@@ -16,7 +16,7 @@ using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Shared.Storage;
using Robust.Shared.Containers;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server.Construction

View File

@@ -10,10 +10,9 @@ using Content.Shared.CCVar;
using Content.Shared.CrewManifest;
using Content.Shared.GameTicking;
using Content.Shared.StationRecords;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.Players;
using Robust.Shared.Player;
namespace Content.Server.CrewManifest;
@@ -60,7 +59,7 @@ public sealed class CrewManifestSystem : EntitySystem
private void OnRequestCrewManifest(RequestCrewManifestMessage message, EntitySessionEventArgs args)
{
if (args.SenderSession is not IPlayerSession sessionCast
if (args.SenderSession is not { } sessionCast
|| !_configManager.GetCVar(CCVars.CrewManifestWithoutEntity))
{
return;
@@ -93,12 +92,12 @@ public sealed class CrewManifestSystem : EntitySystem
private void OnBoundUiClose(EntityUid uid, CrewManifestViewerComponent component, BoundUIClosedEvent ev)
{
var owningStation = _stationSystem.GetOwningStation(uid);
if (owningStation == null || ev.Session is not IPlayerSession sessionCast)
if (owningStation == null || ev.Session is not { } session)
{
return;
}
CloseEui(owningStation.Value, sessionCast, uid);
CloseEui(owningStation.Value, session, uid);
}
/// <summary>
@@ -126,7 +125,7 @@ public sealed class CrewManifestSystem : EntitySystem
private void OpenEuiFromBui(EntityUid uid, CrewManifestViewerComponent component, CrewManifestOpenUiMessage msg)
{
var owningStation = _stationSystem.GetOwningStation(uid);
if (owningStation == null || msg.Session is not IPlayerSession sessionCast)
if (owningStation == null || msg.Session is not { } session)
{
return;
}
@@ -136,7 +135,7 @@ public sealed class CrewManifestSystem : EntitySystem
return;
}
OpenEui(owningStation.Value, sessionCast, uid);
OpenEui(owningStation.Value, session, uid);
}
/// <summary>
@@ -145,7 +144,7 @@ public sealed class CrewManifestSystem : EntitySystem
/// <param name="station">Station that we're displaying the crew manifest for.</param>
/// <param name="session">The player's session.</param>
/// <param name="owner">If this EUI should be 'owned' by an entity.</param>
public void OpenEui(EntityUid station, IPlayerSession session, EntityUid? owner = null)
public void OpenEui(EntityUid station, ICommonSession session, EntityUid? owner = null)
{
if (!HasComp<StationRecordsComponent>(station))
{
@@ -252,7 +251,7 @@ public sealed class CrewManifestCommand : IConsoleCommand
return;
}
if (shell.Player == null || shell.Player is not IPlayerSession session)
if (shell.Player == null || shell.Player is not { } session)
{
shell.WriteLine("You must run this from a client.");
return;

View File

@@ -1,8 +1,6 @@
using Content.Server.Administration;
using Content.Server.Damage.Systems;
using Content.Shared.Administration;
using Content.Shared.Damage.Systems;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Damage.Commands
@@ -18,7 +16,7 @@ namespace Content.Server.Damage.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
EntityUid entity;
switch (args.Length)

View File

@@ -6,7 +6,6 @@ using Content.Shared.Mobs.Systems;
using Content.Shared.Stunnable;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Players;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;

View File

@@ -2,8 +2,8 @@
using System.Threading.Tasks;
using Content.Server.Players.PlayTimeTracking;
using Content.Server.Preferences.Managers;
using Robust.Server.Player;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server.Database;
@@ -25,7 +25,7 @@ public sealed class UserDbDataManager
// TODO: Ideally connected/disconnected would be subscribed to IPlayerManager directly,
// but this runs into ordering issues with game ticker.
public void ClientConnected(IPlayerSession session)
public void ClientConnected(ICommonSession session)
{
DebugTools.Assert(!_users.ContainsKey(session.UserId), "We should not have any cached data on client connect.");
@@ -36,7 +36,7 @@ public sealed class UserDbDataManager
_users.Add(session.UserId, data);
}
public void ClientDisconnected(IPlayerSession session)
public void ClientDisconnected(ICommonSession session)
{
_users.Remove(session.UserId, out var data);
if (data == null)
@@ -49,24 +49,24 @@ public sealed class UserDbDataManager
_playTimeTracking.ClientDisconnected(session);
}
private async Task Load(IPlayerSession session, CancellationToken cancel)
private async Task Load(ICommonSession session, CancellationToken cancel)
{
await Task.WhenAll(
_prefs.LoadData(session, cancel),
_playTimeTracking.LoadData(session, cancel));
}
public Task WaitLoadComplete(IPlayerSession session)
public Task WaitLoadComplete(ICommonSession session)
{
return _users[session.UserId].Task;
}
public bool IsLoadComplete(IPlayerSession session)
public bool IsLoadComplete(ICommonSession session)
{
return GetLoadTask(session).IsCompleted;
}
public Task GetLoadTask(IPlayerSession session)
public Task GetLoadTask(ICommonSession session)
{
return _users[session.UserId].Task;
}

View File

@@ -16,6 +16,7 @@ using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Threading;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -36,7 +37,7 @@ namespace Content.Server.Decals
[Dependency] private readonly MapSystem _mapSystem = default!;
private readonly Dictionary<NetEntity, HashSet<Vector2i>> _dirtyChunks = new();
private readonly Dictionary<IPlayerSession, Dictionary<NetEntity, HashSet<Vector2i>>> _previousSentChunks = new();
private readonly Dictionary<ICommonSession, Dictionary<NetEntity, HashSet<Vector2i>>> _previousSentChunks = new();
private static readonly Vector2 _boundsMinExpansion = new(0.01f, 0.01f);
private static readonly Vector2 _boundsMaxExpansion = new(1.01f, 1.01f);
@@ -197,7 +198,7 @@ namespace Content.Server.Decals
private void OnDecalPlacementRequest(RequestDecalPlacementEvent ev, EntitySessionEventArgs eventArgs)
{
if (eventArgs.SenderSession is not IPlayerSession session)
if (eventArgs.SenderSession is not { } session)
return;
// bad
@@ -226,7 +227,7 @@ namespace Content.Server.Decals
private void OnDecalRemovalRequest(RequestDecalRemovalEvent ev, EntitySessionEventArgs eventArgs)
{
if (eventArgs.SenderSession is not IPlayerSession session)
if (eventArgs.SenderSession is not { } session)
return;
// bad
@@ -427,7 +428,7 @@ namespace Content.Server.Decals
if (PvsEnabled)
{
var players = _playerManager.ServerSessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var players = _playerManager.Sessions.Where(x => x.Status == SessionStatus.InGame).ToArray();
var opts = new ParallelOptions { MaxDegreeOfParallelism = _parMan.ParallelProcessCount };
Parallel.ForEach(players, opts, UpdatePlayer);
}
@@ -435,7 +436,7 @@ namespace Content.Server.Decals
_dirtyChunks.Clear();
}
public void UpdatePlayer(IPlayerSession player)
public void UpdatePlayer(ICommonSession player)
{
var chunksInRange = _chunking.GetChunksForSession(player, ChunkSize, _chunkIndexPool, _chunkViewerPool);
var staleChunks = _chunkViewerPool.Get();
@@ -530,7 +531,7 @@ namespace Content.Server.Decals
}
private void SendChunkUpdates(
IPlayerSession session,
ICommonSession session,
Dictionary<NetEntity, HashSet<Vector2i>> updatedChunks,
Dictionary<NetEntity, HashSet<Vector2i>> staleChunks)
{

View File

@@ -2,7 +2,6 @@ using Content.Server.Administration;
using Content.Server.Disposal.Tube;
using Content.Server.Disposal.Tube.Components;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Disposal
@@ -18,7 +17,7 @@ namespace Content.Server.Disposal
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player?.AttachedEntity == null)
{
shell.WriteLine(Loc.GetString("shell-only-players-can-run-this-command"));

View File

@@ -1,6 +1,6 @@
using Content.Shared.Eui;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
namespace Content.Server.EUI
{

View File

@@ -2,7 +2,7 @@
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.Network;
using Robust.Shared.Players;
using Robust.Shared.Player;
using Robust.Shared.Utility;
namespace Content.Server.EUI

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.EntityList;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
@@ -22,7 +21,7 @@ namespace Content.Server.EntityList
return;
}
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteError("You must be a player to run this command.");
return;

View File

@@ -4,7 +4,6 @@ using Content.Shared.Examine;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Utility;
namespace Content.Server.Examine
@@ -46,7 +45,7 @@ namespace Content.Server.Examine
private void ExamineInfoRequest(ExamineSystemMessages.RequestExamineInfoMessage request, EntitySessionEventArgs eventArgs)
{
var player = (IPlayerSession) eventArgs.SenderSession;
var player = eventArgs.SenderSession;
var session = eventArgs.SenderSession;
var channel = player.ConnectedClient;
var entity = GetEntity(request.NetEntity);

View File

@@ -1,9 +1,9 @@
using System.Numerics;
using Content.Shared.Fluids;
using Content.Shared.Fluids.Components;
using Robust.Server.Player;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Timing;
namespace Content.Server.Fluids.EntitySystems;
@@ -14,10 +14,10 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly PuddleSystem _puddle = default!;
private readonly HashSet<IPlayerSession> _playerObservers = new();
private readonly HashSet<ICommonSession> _playerObservers = new();
private List<Entity<MapGridComponent>> _grids = new();
public bool ToggleObserver(IPlayerSession observer)
public bool ToggleObserver(ICommonSession observer)
{
NextTick ??= _timing.CurTime + Cooldown;
@@ -31,7 +31,7 @@ public sealed class PuddleDebugDebugOverlaySystem : SharedPuddleDebugOverlaySyst
return true;
}
private void RemoveObserver(IPlayerSession observer)
private void RemoveObserver(ICommonSession observer)
{
if (!_playerObservers.Remove(observer))
{

View File

@@ -1,7 +1,6 @@
using Content.Server.Administration;
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Fluids;
@@ -15,7 +14,7 @@ public sealed class ShowFluidsCommand : IConsoleCommand
public string Help => $"Usage: {Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{
shell.WriteLine("You must be a player to use this command.");

View File

@@ -2,7 +2,6 @@ using Content.Server.Station.Systems;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Content.Shared.Roles;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
@@ -30,7 +29,7 @@ namespace Content.Server.GameTicking.Commands
return;
}
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (player == null)
{

View File

@@ -1,6 +1,5 @@
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.GameTicking.Commands
@@ -14,7 +13,7 @@ namespace Content.Server.GameTicking.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
return;
}

View File

@@ -14,7 +14,7 @@ namespace Content.Server.GameTicking.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (args.Length > 1)
{
shell.WriteLine("Must provide <= 1 argument.");

View File

@@ -1,5 +1,4 @@
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.GameTicking.Commands
@@ -13,7 +12,7 @@ namespace Content.Server.GameTicking.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player as IPlayerSession;
var player = shell.Player;
if (args.Length != 1)
{
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));

View File

@@ -11,7 +11,7 @@ using Content.Shared.Ghost;
using Content.Shared.Mind;
using Content.Shared.Mobs.Components;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Player;
namespace Content.Server.GameTicking
{
@@ -29,7 +29,7 @@ namespace Content.Server.GameTicking
/// </summary>
public GamePresetPrototype? CurrentPreset { get; private set; }
private bool StartPreset(IPlayerSession[] origReadyPlayers, bool force)
private bool StartPreset(ICommonSession[] origReadyPlayers, bool force)
{
var startAttempt = new RoundStartAttemptEvent(origReadyPlayers, force);
RaiseLocalEvent(startAttempt);
@@ -214,7 +214,7 @@ namespace Content.Server.GameTicking
{
if (mind.Session != null) // Logging is suppressed to prevent spam from ghost attempts caused by movement attempts
{
_chatManager.DispatchServerMessage((IPlayerSession) mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
_chatManager.DispatchServerMessage(mind.Session, Loc.GetString("comp-mind-ghosting-prevented"),
true);
}

View File

@@ -1,10 +1,8 @@
using System.Linq;
using Content.Shared.GameTicking;
using Content.Server.Station.Components;
using Robust.Server.Player;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Players;
using System.Text;
namespace Content.Server.GameTicking
@@ -79,7 +77,7 @@ namespace Content.Server.GameTicking
("roundId", RoundId), ("playerCount", playerCount), ("readyCount", readyCount), ("mapName", stationNames.ToString()),("gmTitle", gmTitle),("desc", desc));
}
private TickerLobbyStatusEvent GetStatusMsg(IPlayerSession session)
private TickerLobbyStatusEvent GetStatusMsg(ICommonSession session)
{
_playerGameStatuses.TryGetValue(session.UserId, out var status);
return new TickerLobbyStatusEvent(RunLevel != GameRunLevel.PreRoundLobby, LobbySong, LobbyBackground,status == PlayerGameStatus.ReadyToPlay, _roundStartTime, RoundPreloadTime, _roundStartTimeSpan, Paused);
@@ -87,7 +85,7 @@ namespace Content.Server.GameTicking
private void SendStatusToAll()
{
foreach (var player in _playerManager.ServerSessions)
foreach (var player in _playerManager.Sessions)
{
RaiseNetworkEvent(GetStatusMsg(player), player.ConnectedClient);
}
@@ -148,7 +146,7 @@ namespace Content.Server.GameTicking
}
}
public void ToggleReady(IPlayerSession player, bool ready)
public void ToggleReady(ICommonSession player, bool ready)
{
if (!_playerGameStatuses.ContainsKey(player.UserId))
return;

View File

@@ -1,12 +1,13 @@
using Content.Server.Database;
using Content.Server.Players;
using Content.Shared.GameTicking;
using Content.Shared.GameWindow;
using Content.Shared.Players;
using Content.Shared.Preferences;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Enums;
using Robust.Shared.Player;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -17,6 +18,7 @@ namespace Content.Server.GameTicking
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IServerDbManager _dbManager = default!;
[Dependency] private readonly ActorSystem _actor = default!;
private void InitializePlayer()
{
@@ -49,14 +51,14 @@ namespace Content.Server.GameTicking
// Always make sure the client has player data.
if (session.Data.ContentDataUncast == null)
{
var data = new PlayerData(session.UserId, args.Session.Name);
var data = new ContentPlayerData(session.UserId, args.Session.Name);
data.Mind = mindId;
session.Data.ContentDataUncast = data;
}
// Make the player actually join the game.
// timer time must be > tick length
Timer.Spawn(0, args.Session.JoinGame);
Timer.Spawn(0, () => _playerManager.JoinGame(args.Session));
var record = await _dbManager.GetPlayerRecordByUserId(args.Session.UserId);
var firstConnection = record != null &&
@@ -100,9 +102,16 @@ namespace Content.Server.GameTicking
}
else
{
// Simply re-attach to existing entity.
session.AttachToEntity(mind.CurrentEntity);
PlayerJoinGame(session);
if (_actor.Attach(mind.CurrentEntity, session))
{
PlayerJoinGame(session);
}
else
{
Log.Error(
$"Failed to attach player {session} with mind {ToPrettyString(mindId)} to its current entity {ToPrettyString(mind.CurrentEntity)}");
SpawnObserverWaitDb();
}
}
break;
@@ -146,12 +155,12 @@ namespace Content.Server.GameTicking
}
}
private HumanoidCharacterProfile GetPlayerProfile(IPlayerSession p)
private HumanoidCharacterProfile GetPlayerProfile(ICommonSession p)
{
return (HumanoidCharacterProfile) _prefsManager.GetPreferences(p.UserId).SelectedCharacter;
}
public void PlayerJoinGame(IPlayerSession session, bool silent = false)
public void PlayerJoinGame(ICommonSession session, bool silent = false)
{
if (!silent)
_chatManager.DispatchServerMessage(session, Loc.GetString("game-ticker-player-join-game-message"));
@@ -162,7 +171,7 @@ namespace Content.Server.GameTicking
RaiseNetworkEvent(new TickerJoinGameEvent(), session.ConnectedClient);
}
private void PlayerJoinLobby(IPlayerSession session)
private void PlayerJoinLobby(ICommonSession session)
{
_playerGameStatuses[session.UserId] = LobbyEnabled ? PlayerGameStatus.NotReadyToPlay : PlayerGameStatus.ReadyToPlay;
_db.AddRoundPlayers(RoundId, session.UserId);
@@ -182,9 +191,9 @@ namespace Content.Server.GameTicking
public sealed class PlayerJoinedLobbyEvent : EntityEventArgs
{
public readonly IPlayerSession PlayerSession;
public readonly ICommonSession PlayerSession;
public PlayerJoinedLobbyEvent(IPlayerSession playerSession)
public PlayerJoinedLobbyEvent(ICommonSession playerSession)
{
PlayerSession = playerSession;
}

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;

Some files were not shown because too many files have changed in this diff Show More