using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Robust.Shared.Enums; using Robust.Shared.GameStates; using Robust.Shared.Input; using Robust.Shared.Map; using Robust.Shared.Network; using Robust.Shared.Timing; namespace Robust.Server.Player { /// /// Manages each players session when connected to the server. /// public interface IPlayerManager : Shared.Players.ISharedPlayerManager { BoundKeyMap KeyMap { get; } /// /// Raised when the of a is changed. /// event EventHandler PlayerStatusChanged; /// /// Initializes the manager. /// /// Maximum number of players that can connect to this server at one time. void Initialize(int maxPlayers); bool TryGetSessionByUsername(string username, [NotNullWhen(true)] out IPlayerSession? session); /// /// Returns the client session of the networkId. /// /// IPlayerSession GetSessionByUserId(NetUserId index); IPlayerSession GetSessionByChannel(INetChannel channel); bool TryGetSessionByChannel(INetChannel channel, [NotNullWhen(true)] out IPlayerSession? session); bool TryGetSessionById(NetUserId userId, [NotNullWhen(true)] out IPlayerSession? session); /// /// Checks to see if a PlayerIndex is a valid session. /// bool ValidSessionId(NetUserId index); IPlayerData GetPlayerData(NetUserId userId); bool TryGetPlayerData(NetUserId userId, [NotNullWhen(true)] out IPlayerData? data); bool TryGetPlayerDataByUsername(string userName, [NotNullWhen(true)] out IPlayerData? data); bool HasPlayerData(NetUserId userId); /// /// Tries to get the user ID of the user with the specified username. /// /// /// This only works if this user has already connected once before during this server run. /// It does still work if the user has since disconnected. /// bool TryGetUserId(string userName, out NetUserId userId); IEnumerable GetAllPlayerData(); void DetachAll(); List GetPlayersInRange(MapCoordinates worldPos, int range); List GetPlayersInRange(EntityCoordinates worldPos, int range); List GetPlayersBy(Func predicate); List GetAllPlayers(); List? GetPlayerStates(GameTick fromTick); } }