* mindcomponent namespace * wip MindRole stuff * admin player tab * mindroletype comment * mindRolePrototype redesign * broken param * wip RoleType implementation * basic role type switching for antags * traitor fix * fix AdminPanel update * the renameningTM * cleanup * feature uncreeping * roletypes on mind roles * update MindComponent.RoleType when MindRoles change * ghostrole configuration * ghostrole config improvements * live update of roleType on the character window * logging stuff and notes * remove thing no one asked for * weh * Mind Role Entities wip * headrev count fix * silicon stuff, cleanup * exclusive antag config, cleanup * jobroleadd overwerite * logging stuff * MindHasRole cleanup, admin log stuff * last second cleanup * ocd * move roletypeprototype to its own file, minor note stuff * remove Roletype.Created * log stuff * roletype setup for ghostroles and autotraitor reinforcements * ghostrole type configs * adjustable admin overlay * cleanup * fix this in its own PR * silicon antagonist * borg stuff * mmi roletype handling * spawnable borg roletype handling * weh * ghost role cleanup * weh * RoleEvent update * polish * log stuff * admin overlay config * ghostrolecomponent cleanup * weh * admin overlay code cleanup * minor cleanup * Obsolete MindRoleAddedEvent * comment * minor code cleanup * MindOnDoGreeting fix * Role update message * fix duplicate job greeting for cyborgs * fix emag job message dupe * nicer-looking role type update * crew aligned * syndicate assault borg role fix * fix test fail * fix a merge mistake * fix LoneOp role type * Update Content.Client/Administration/AdminNameOverlay.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * Update Content.Shared/Roles/SharedRoleSystem.cs Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * comment formatting Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * change logging category Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * fix a space Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * use MindAddRoles Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * get MindComponent from TryGetMind Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * move var declaration outside loop * remove TryComp * take RoleEnum behind the barn * don't use ensurecomp unnecessarily * cvar comments * toggleableghostrolecomponent documentation * skrek * use EntProtoId * mindrole config * merge baserolecomponent into basemindrolecomponent * ai and borg silicon role tweaks * formatting Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * I will end you (the color) Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * use LocId type for a locale id * update RoleEvent documentation * update RoleEvent documentation * remove obsolete MindRoleAddedEvent * refine MindRolesUpdate() * use dependency Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * inject dependency Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> * roleType.Name no longer required * reformatted draw code logic * GhostRoleMarkerRoleComponent comment * minor SharedRoleSystem cleanup * StartingMindRoleComponent, unhardcode roundstart silicon * Update Content.Shared/Roles/SharedRoleSystem.cs * remove a whitespace --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
119 lines
4.5 KiB
C#
119 lines
4.5 KiB
C#
using Content.Shared.GameTicking;
|
|
using Content.Shared.Mind.Components;
|
|
using Robust.Shared.GameStates;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
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"/>.
|
|
/// </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)]
|
|
public sealed partial class MindComponent : Component
|
|
{
|
|
[DataField, AutoNetworkedField]
|
|
public List<EntityUid> Objectives = new();
|
|
|
|
/// <summary>
|
|
/// The session ID of the player owning this mind.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, 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))]
|
|
public NetUserId? OriginalOwnerUserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// The first entity that this mind controlled. Used for round end information.
|
|
/// Might be relevant if the player has ghosted since.
|
|
/// </summary>
|
|
[AutoNetworkedField]
|
|
public NetEntity? OriginalOwnedEntity; // TODO WeakEntityReference make this a Datafield again
|
|
// This is a net entity, because this field currently does 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 bool IsVisitingEntity => VisitingEntity != null;
|
|
|
|
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
|
public EntityUid? VisitingEntity { get; set; }
|
|
|
|
[ViewVariables]
|
|
public EntityUid? CurrentEntity => VisitingEntity ?? OwnedEntity;
|
|
|
|
[DataField, AutoNetworkedField, 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]
|
|
public TimeSpan? TimeOfDeath { get; set; }
|
|
|
|
/// <summary>
|
|
/// The entity currently owned by this mind.
|
|
/// Can be null.
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField, Access(typeof(SharedMindSystem))]
|
|
public EntityUid? OwnedEntity { get; set; }
|
|
|
|
/// <summary>
|
|
/// An enumerable over all the objective entities this mind has.
|
|
/// </summary>
|
|
[ViewVariables, Obsolete("Use Objectives field")]
|
|
public IEnumerable<EntityUid> AllObjectives => Objectives;
|
|
|
|
/// <summary>
|
|
/// Prevents user from ghosting out
|
|
/// </summary>
|
|
[DataField]
|
|
public bool PreventGhosting { get; set; }
|
|
|
|
/// <summary>
|
|
/// Prevents user from suiciding
|
|
/// </summary>
|
|
[DataField]
|
|
public bool PreventSuicide { get; set; }
|
|
|
|
/// <summary>
|
|
/// Mind Role Entities belonging to this Mind
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public List<EntityUid> MindRoles = new List<EntityUid>();
|
|
|
|
/// <summary>
|
|
/// The mind's current antagonist/special role, or lack thereof;
|
|
/// </summary>
|
|
[DataField, AutoNetworkedField]
|
|
public ProtoId<RoleTypePrototype> RoleType = "Neutral";
|
|
|
|
/// <summary>
|
|
/// The session of the player owning this 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; }
|
|
}
|