@@ -1,86 +1,84 @@
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Shared.Mind
|
||||
{
|
||||
/// <summary>
|
||||
/// This component stores information about a player/mob mind. The component will be attached to a mind-entity
|
||||
/// which is stored in null-space. The entity that is currently "possessed" by the mind will have a
|
||||
/// <see cref="MindContainerComponent"/>.
|
||||
/// This is added as a component to mind entities, not to player entities.
|
||||
/// <see cref="MindContainerComponent"/> for the one that is added to players.
|
||||
/// A mind represents the IC "mind" of a player.
|
||||
/// Roles are attached as components to its owning entity.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Roles are attached as components on the mind-entity entity.
|
||||
/// Think of it like this: if a player is supposed to have their memories,
|
||||
/// their mind follows along.
|
||||
///
|
||||
/// Things such as respawning do not follow, because you're a new character.
|
||||
/// Getting borged, cloned, turned into a catbeast, etc... will keep it following you.
|
||||
///
|
||||
/// Minds are stored in null-space, and are thus generally not set to players unless that player is the owner
|
||||
/// of the mind. As a result it should be safe to network "secret" information like roles & objectives
|
||||
/// </remarks>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
[RegisterComponent]
|
||||
public sealed partial class MindComponent : Component
|
||||
{
|
||||
[DataField, AutoNetworkedField]
|
||||
public List<EntityUid> Objectives = new();
|
||||
internal readonly List<EntityUid> Objectives = new();
|
||||
|
||||
/// <summary>
|
||||
/// The session ID of the player owning this mind.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
||||
[ViewVariables, Access(typeof(SharedMindSystem))]
|
||||
public NetUserId? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The session ID of the original owner, if any.
|
||||
/// May end up used for round-end information (as the owner may have abandoned Mind since)
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
||||
[ViewVariables, Access(typeof(SharedMindSystem))]
|
||||
public NetUserId? OriginalOwnerUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The first entity that this mind controlled. Used for round end information.
|
||||
/// Entity UID for the first entity that this mind controlled. Used for round end.
|
||||
/// Might be relevant if the player has ghosted since.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public NetEntity? OriginalOwnedEntity;
|
||||
// This is a net entity, because this field currently ddoes not get set to null when this entity is deleted.
|
||||
// This is a lazy way to ensure that people check that the entity still exists.
|
||||
// TODO MIND Fix this properly by adding an OriginalMindContainerComponent or something like that.
|
||||
[ViewVariables] public EntityUid? OriginalOwnedEntity;
|
||||
|
||||
[ViewVariables]
|
||||
public bool IsVisitingEntity => VisitingEntity != null;
|
||||
|
||||
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
||||
[ViewVariables, Access(typeof(SharedMindSystem))]
|
||||
public EntityUid? VisitingEntity { get; set; }
|
||||
|
||||
[ViewVariables]
|
||||
public EntityUid? CurrentEntity => VisitingEntity ?? OwnedEntity;
|
||||
|
||||
[DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? CharacterName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time of death for this Mind.
|
||||
/// Can be null - will be null if the Mind is not considered "dead".
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[ViewVariables]
|
||||
public TimeSpan? TimeOfDeath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The component currently owned by this mind.
|
||||
/// Can be null.
|
||||
/// </summary>
|
||||
[ViewVariables] public MindContainerComponent? OwnedComponent;
|
||||
|
||||
/// <summary>
|
||||
/// The entity currently owned by this mind.
|
||||
/// Can be null.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
||||
[ViewVariables, Access(typeof(SharedMindSystem))]
|
||||
public EntityUid? OwnedEntity { get; set; }
|
||||
|
||||
// TODO move objectives out of mind component
|
||||
/// <summary>
|
||||
/// An enumerable over all the objective entities this mind has.
|
||||
/// </summary>
|
||||
[ViewVariables, Obsolete("Use Objectives field")]
|
||||
[ViewVariables]
|
||||
public IEnumerable<EntityUid> AllObjectives => Objectives;
|
||||
|
||||
/// <summary>
|
||||
@@ -102,7 +100,6 @@ namespace Content.Shared.Mind
|
||||
/// Can be null, in which case the player is currently not logged in.
|
||||
/// </summary>
|
||||
[ViewVariables, Access(typeof(SharedMindSystem), typeof(SharedGameTicker))]
|
||||
// TODO remove this after moving IPlayerManager functions to shared
|
||||
public ICommonSession? Session { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user