Un-revert IPlayerManager refactor (#21244)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Administration.Managers;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Buckle;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Content.Shared.Input;
|
||||
using Content.Shared.Localizations;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Hands.EntitySystems;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ using Robust.Shared.Network;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Mind
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ using Content.Shared.Objectives.Systems;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Mind;
|
||||
@@ -410,11 +410,11 @@ public abstract class SharedMindSystem : EntitySystem
|
||||
}
|
||||
|
||||
public bool TryGetMind(
|
||||
PlayerData player,
|
||||
ContentPlayerData contentPlayer,
|
||||
out EntityUid mindId,
|
||||
[NotNullWhen(true)] out MindComponent? mind)
|
||||
{
|
||||
mindId = player.Mind ?? default;
|
||||
mindId = contentPlayer.Mind ?? default;
|
||||
return TryComp(mindId, out mind);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Shared.Movement.Events;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ using Content.Shared.Ghost;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Movement.Systems;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Players;
|
||||
|
||||
/// <summary>
|
||||
/// Content side for all data that tracks a player session.
|
||||
/// Use <see cref="PlaIPlayerDatarver.Player.IPlayerData)"/> to retrieve this from an <see cref="IPlayerData"/>.
|
||||
/// Use <see cref="PlaIPlayerDatarver.Player.IPlayerData)"/> to retrieve this from an <see cref="PlayerData"/>.
|
||||
/// <remarks>Not currently used on the client.</remarks>
|
||||
/// </summary>
|
||||
public sealed class PlayerData
|
||||
public sealed class ContentPlayerData
|
||||
{
|
||||
/// <summary>
|
||||
/// The session ID of the player owning this data.
|
||||
@@ -38,21 +37,9 @@ public sealed class PlayerData
|
||||
/// </summary>
|
||||
public bool ExplicitlyDeadminned { get; set; }
|
||||
|
||||
public PlayerData(NetUserId userId, string name)
|
||||
public ContentPlayerData(NetUserId userId, string name)
|
||||
{
|
||||
UserId = userId;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class PlayerDataExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the correctly cast instance of content player data from an engine player data storage.
|
||||
/// </summary>
|
||||
public static PlayerData? ContentData(this IPlayerData data)
|
||||
{
|
||||
return (PlayerData?) data.ContentDataUncast;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Content.Shared/Players/PlayerDataExt.cs
Normal file
30
Content.Shared/Players/PlayerDataExt.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Players;
|
||||
|
||||
public static class PlayerDataExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the correctly cast instance of content player data from an engine player data storage.
|
||||
/// </summary>
|
||||
public static ContentPlayerData? ContentData(this SessionData data)
|
||||
{
|
||||
return (ContentPlayerData?) data.ContentDataUncast;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the correctly cast instance of content player data from an engine player data storage.
|
||||
/// </summary>
|
||||
public static ContentPlayerData? ContentData(this ICommonSession session)
|
||||
{
|
||||
return session.Data.ContentData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mind that is associated with this player.
|
||||
/// </summary>
|
||||
public static EntityUid? GetMind(this ICommonSession session)
|
||||
{
|
||||
return session.Data.ContentData()?.Mind;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Players;
|
||||
|
||||
@@ -8,5 +8,5 @@ namespace Content.Shared.Players;
|
||||
/// </summary>
|
||||
public abstract class SharedPlayerSystem : EntitySystem
|
||||
{
|
||||
public abstract PlayerData? ContentData(ICommonSession? session);
|
||||
public abstract ContentPlayerData? ContentData(ICommonSession? session);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Popups
|
||||
|
||||
@@ -12,7 +12,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Shared.Pulling
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user