using Content.Shared.Emoting; using Content.Shared.Hands; using Content.Shared.Interaction.Events; using Content.Shared.InteractionVerbs.Events; using Content.Shared.Item; using Content.Shared.Popups; 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(OnAttemptInteract); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); SubscribeLocalEvent(OnAttempt); } private void OnAttemptInteract(Entity ent, ref InteractionAttemptEvent args) { if (!ent.Comp.CanGhostInteract) args.Cancelled = true; } 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; } } /// /// A client to server request to get places a ghost can warp to. /// Response is sent via /// [Serializable, NetSerializable] public sealed class GhostWarpsRequestEvent : EntityEventArgs { } /// /// Goobstation - A server to client request for them to spawn at the ghost bar /// [Serializable, NetSerializable] public sealed class GhostBarSpawnEvent : EntityEventArgs { } // WWDP-Start /// /// An player body a ghost can warp to. /// This is used as part of /// [Serializable, NetSerializable] public struct GhostWarp { public GhostWarp(NetEntity entity, string displayName, string subGroup, string description, Color? color) { Entity = entity; DisplayName = displayName; SubGroup = subGroup; Color = color; Description = description; } public NetEntity Entity { get; } public string DisplayName { get; } public string SubGroup { get; } public string Description { get; } public Color? Color { get; } public WarpGroup Group { get; set; } = WarpGroup.Location; } [Serializable, NetSerializable, Flags] public enum WarpGroup { Location = 0, Ghost = 1 << 0, Alive = 1 << 1, Dead = 1 << 2, Left = 1 << 3, Antag = 1 << 4, Department = 1 << 5, Other = 1 << 6, AliveAntag = Alive | Antag, DeadAntag = Dead | Antag, AliveDepartment = Alive | Department, DeadDepartment = Dead | Department, LeftDepartment = Left | Department, AliveOther = Alive | Other } /// /// A server to client response for a . /// Contains players, and locations a ghost can warp to /// [Serializable, NetSerializable] public sealed class GhostWarpsResponseEvent : EntityEventArgs { public GhostWarpsResponseEvent(List warps) { Warps = warps; } /// /// A list of warps to teleport. /// public List Warps { 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; }