using Content.Shared._White.Antag; using Content.Shared.Emoting; using Content.Shared.Hands; using Content.Shared.Interaction.Events; using Content.Shared.Item; using Content.Shared.Popups; using Content.Shared.Roles; using Robust.Shared.Serialization; namespace Content.Shared.Ghost { /// /// System for the . /// Prevents ghosts from interacting when is false. /// public abstract class SharedGhostSystem : EntitySystem { [Dependency] protected readonly SharedPopupSystem Popup = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); } private void OnAttempt(EntityUid uid, GhostComponent component, CancellableEntityEventArgs args) { if (!component.CanGhostInteract) args.Cancel(); } public void SetTimeOfDeath(EntityUid uid, TimeSpan value, GhostComponent? component) { if (!Resolve(uid, ref component)) return; component.TimeOfDeath = value; } public void SetCanReturnToBody(EntityUid uid, bool value, GhostComponent? component = null) { if (!Resolve(uid, ref component)) return; component.CanReturnToBody = value; } public void SetCanReturnToBody(GhostComponent component, bool value) { component.CanReturnToBody = value; } public virtual void SetVisible(Entity ghost, bool visible) { if (!Resolve(ghost.Owner, ref ghost.Comp)) return; ghost.Comp.Visible = visible; Dirty(ghost); } } /// /// A client to server request to get places a ghost can warp to. /// Response is sent via /// [Serializable, NetSerializable] public sealed class GhostWarpsRequestEvent : EntityEventArgs { } /// /// An player body a ghost can warp to. /// This is used as part of /// [Serializable, NetSerializable] public struct GhostWarpPlayer { public GhostWarpPlayer(NetEntity entity, string playerName, string playerJobName, string playerDepartmentID, bool isGhost, bool isLeft, bool isDead, bool isAlive) { Entity = entity; Name = playerName; JobName = playerJobName; DepartmentID = playerDepartmentID; IsGhost = isGhost; IsLeft = isLeft; IsDead = isDead; IsAlive = isAlive; } /// /// The entity representing the warp point. /// This is passed back to the server in /// public NetEntity Entity { get; } /// /// The display player name to be surfaced in the ghost warps menu /// public string Name { get; } /// /// The display player job to be surfaced in the ghost warps menu /// public string JobName { get; } /// /// The display player department to be surfaced in the ghost warps menu /// public string DepartmentID { get; set; } /// /// Is player is ghost /// public bool IsGhost { get; } /// /// Is player body alive /// public bool IsAlive { get; } /// /// Is player body dead /// public bool IsDead { get; } /// /// Is player left from body /// public bool IsLeft { get; } } [Serializable, NetSerializable] public struct GhostWarpGlobalAntagonist { public GhostWarpGlobalAntagonist(NetEntity entity, string playerName, string antagonistName, string antagonistDescription, string prototypeID) { Entity = entity; Name = playerName; AntagonistName = antagonistName; AntagonistDescription = antagonistDescription; PrototypeID = prototypeID; } /// /// The entity representing the warp point. /// This is passed back to the server in /// public NetEntity Entity { get; } /// /// The display player name to be surfaced in the ghost warps menu /// public string Name { get; } /// /// The display antagonist name to be surfaced in the ghost warps menu /// public string AntagonistName { get; } /// /// The display antagonist description to be surfaced in the ghost warps menu /// public string AntagonistDescription { get; } /// /// A antagonist prototype id /// public string PrototypeID { get; } } /// /// An individual place a ghost can warp to. /// This is used as part of /// [Serializable, NetSerializable] public struct GhostWarpPlace { public GhostWarpPlace(NetEntity entity, string name, string description) { Entity = entity; Name = name; Description = description; } /// /// The entity representing the warp point. /// This is passed back to the server in /// public NetEntity Entity { get; } /// /// The display name to be surfaced in the ghost warps menu /// public string Name { get; } /// /// The display name to be surfaced in the ghost warps menu /// public string Description { get; } } /// /// A server to client response for a . /// Contains players, and locations a ghost can warp to /// [Serializable, NetSerializable] public sealed class GhostWarpsResponseEvent : EntityEventArgs // WD edit { public GhostWarpsResponseEvent(List players, List places, List antagonists) { Players = players; Places = places; Antagonists = antagonists; } /// /// A list of players to teleport. /// public List Players { get; } /// /// A list of warp points. /// public List Places { get; } /// /// A list of antagonists to teleport. /// public List Antagonists { get; } } /// /// A client to server request for their ghost to be warped to an entity /// [Serializable, NetSerializable] public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs { public NetEntity Target { get; } public GhostWarpToTargetRequestEvent(NetEntity target) { Target = target; } } /// /// A client to server request for their ghost to be warped to the most followed entity. /// [Serializable, NetSerializable] public sealed class GhostnadoRequestEvent : EntityEventArgs; /// /// A client to server request for their ghost to return to body /// [Serializable, NetSerializable] public sealed class GhostReturnToBodyRequest : EntityEventArgs { } /// /// A server to client update with the available ghost role count /// [Serializable, NetSerializable] public sealed class GhostUpdateGhostRoleCountEvent : EntityEventArgs { public int AvailableGhostRoles { get; } public GhostUpdateGhostRoleCountEvent(int availableGhostRoleCount) { AvailableGhostRoles = availableGhostRoleCount; } } [Serializable, NetSerializable] public sealed class GhostReturnToRoundRequest : EntityEventArgs { } }