using Content.Server.Mobs; using SS14.Server.Interfaces.Player; using SS14.Shared.IoC; using SS14.Shared.Network; using SS14.Shared.ViewVariables; namespace Content.Server.Players { /// /// Content side for all data that tracks a player session. /// Use to retrieve this from an . /// public sealed class PlayerData { /// /// The session ID of the player owning this data. /// [ViewVariables] public NetSessionId SessionId { get; } /// /// The currently occupied mind of the player owning this data. /// DO NOT DIRECTLY SET THIS UNLESS YOU KNOW WHAT YOU'RE DOING. /// [ViewVariables] public Mind Mind { get; set; } public void WipeMind() { Mind?.ChangeOwningPlayer(null); Mind = null; } public PlayerData(NetSessionId sessionId) { SessionId = sessionId; } } public static class PlayerDataExt { /// /// Gets the correctly cast instance of content player data from an engine player data storage. /// public static PlayerData ContentData(this IPlayerData data) { return (PlayerData)data.ContentDataUncast; } /// /// Gets the correctly cast instance of content player data from an engine player data storage. /// public static PlayerData ContentData(this IPlayerSession session) { return session.Data.ContentData(); } } }