2023-08-30 21:46:11 -07:00
|
|
|
|
using Content.Shared.GameTicking;
|
|
|
|
|
|
using Content.Shared.Mind.Components;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.Network;
|
2023-08-30 21:46:11 -07:00
|
|
|
|
using Robust.Shared.Players;
|
2018-08-21 00:59:04 +02:00
|
|
|
|
|
2023-08-30 21:46:11 -07:00
|
|
|
|
namespace Content.Shared.Mind
|
2018-08-21 00:59:04 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
2023-09-11 14:47:30 -07:00
|
|
|
|
/// This is added as a component to mind entities, not to player entities.
|
|
|
|
|
|
/// <see cref="MindContainerComponent"/> for the one that is added to players.
|
2023-08-28 16:53:24 -07:00
|
|
|
|
/// A mind represents the IC "mind" of a player.
|
|
|
|
|
|
/// Roles are attached as components to its owning entity.
|
2018-08-21 00:59:04 +02:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// Think of it like this: if a player is supposed to have their memories,
|
|
|
|
|
|
/// their mind follows along.
|
2018-09-09 15:34:43 +02:00
|
|
|
|
///
|
2018-08-21 00:59:04 +02:00
|
|
|
|
/// 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.
|
|
|
|
|
|
/// </remarks>
|
2023-08-28 16:53:24 -07:00
|
|
|
|
[RegisterComponent]
|
|
|
|
|
|
public sealed partial class MindComponent : Component
|
2018-08-21 00:59:04 +02:00
|
|
|
|
{
|
2023-09-16 07:18:10 +01:00
|
|
|
|
internal readonly List<EntityUid> Objectives = new();
|
2022-02-06 21:25:04 -05:00
|
|
|
|
|
2018-08-21 00:59:04 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The session ID of the player owning this mind.
|
|
|
|
|
|
/// </summary>
|
2023-08-30 21:46:11 -07:00
|
|
|
|
[ViewVariables, Access(typeof(SharedMindSystem))]
|
2023-06-21 13:18:16 +12:00
|
|
|
|
public NetUserId? UserId { get; set; }
|
2018-08-21 00:59:04 +02:00
|
|
|
|
|
2021-11-15 18:14:34 +00:00
|
|
|
|
/// <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>
|
2023-08-30 21:46:11 -07:00
|
|
|
|
[ViewVariables, Access(typeof(SharedMindSystem))]
|
2023-06-21 13:18:16 +12:00
|
|
|
|
public NetUserId? OriginalOwnerUserId { get; set; }
|
2021-11-15 18:14:34 +00:00
|
|
|
|
|
2023-08-01 10:46:06 +12:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Entity UID for the first entity that this mind controlled. Used for round end.
|
|
|
|
|
|
/// Might be relevant if the player has ghosted since.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables] public EntityUid? OriginalOwnedEntity;
|
|
|
|
|
|
|
2018-09-20 18:19:04 +02:00
|
|
|
|
[ViewVariables]
|
2021-12-06 16:40:04 +01:00
|
|
|
|
public bool IsVisitingEntity => VisitingEntity != null;
|
2018-09-20 18:19:04 +02:00
|
|
|
|
|
2023-08-30 21:46:11 -07:00
|
|
|
|
[ViewVariables, Access(typeof(SharedMindSystem))]
|
2023-06-18 11:33:19 -07:00
|
|
|
|
public EntityUid? VisitingEntity { get; set; }
|
2018-09-20 18:19:04 +02:00
|
|
|
|
|
2023-06-18 11:33:19 -07:00
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
public EntityUid? CurrentEntity => VisitingEntity ?? OwnedEntity;
|
2018-09-20 18:19:04 +02:00
|
|
|
|
|
2020-04-18 00:38:19 +02:00
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-03-16 15:50:20 +01:00
|
|
|
|
public string? CharacterName { get; set; }
|
2020-04-18 00:38:19 +02:00
|
|
|
|
|
2021-11-11 11:17:23 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The time of death for this Mind.
|
|
|
|
|
|
/// Can be null - will be null if the Mind is not considered "dead".
|
|
|
|
|
|
/// </summary>
|
2022-06-07 15:26:28 +02:00
|
|
|
|
[ViewVariables]
|
2023-06-18 11:33:19 -07:00
|
|
|
|
public TimeSpan? TimeOfDeath { get; set; }
|
2021-11-11 11:17:23 -04:00
|
|
|
|
|
2018-08-21 00:59:04 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The component currently owned by this mind.
|
|
|
|
|
|
/// Can be null.
|
|
|
|
|
|
/// </summary>
|
2023-10-07 12:00:48 +11:00
|
|
|
|
[ViewVariables] public MindContainerComponent? OwnedComponent;
|
2018-08-21 00:59:04 +02:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The entity currently owned by this mind.
|
|
|
|
|
|
/// Can be null.
|
|
|
|
|
|
/// </summary>
|
2023-08-30 21:46:11 -07:00
|
|
|
|
[ViewVariables, Access(typeof(SharedMindSystem))]
|
2023-06-21 13:18:16 +12:00
|
|
|
|
public EntityUid? OwnedEntity { get; set; }
|
2018-08-21 00:59:04 +02:00
|
|
|
|
|
2023-08-28 16:53:24 -07:00
|
|
|
|
// TODO move objectives out of mind component
|
2020-11-22 08:38:07 +01:00
|
|
|
|
/// <summary>
|
2023-09-16 07:18:10 +01:00
|
|
|
|
/// An enumerable over all the objective entities this mind has.
|
2020-11-22 08:38:07 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables]
|
2023-09-16 07:18:10 +01:00
|
|
|
|
public IEnumerable<EntityUid> AllObjectives => Objectives;
|
2020-11-22 08:38:07 +01:00
|
|
|
|
|
2022-12-19 21:55:45 -06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Prevents user from ghosting out
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
[DataField("preventGhosting")]
|
|
|
|
|
|
public bool PreventGhosting { get; set; }
|
|
|
|
|
|
|
2023-02-16 18:36:10 -06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Prevents user from suiciding
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
|
[DataField("preventSuicide")]
|
|
|
|
|
|
public bool PreventSuicide { get; set; }
|
|
|
|
|
|
|
2018-08-21 00:59:04 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The session of the player owning this mind.
|
|
|
|
|
|
/// Can be null, in which case the player is currently not logged in.
|
|
|
|
|
|
/// </summary>
|
2023-08-30 21:46:11 -07:00
|
|
|
|
[ViewVariables, Access(typeof(SharedMindSystem), typeof(SharedGameTicker))]
|
|
|
|
|
|
public ICommonSession? Session { get; set; }
|
2018-08-21 00:59:04 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|