using Content.Shared.Emoting; using Content.Shared.Hands; using Content.Shared.Interaction.Events; using Content.Shared.Item; using Robust.Shared.Serialization; namespace Content.Shared.Ghost { /// /// System for the . /// Prevents ghosts from interacting when is false. /// public abstract class SharedGhostSystem : EntitySystem { 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; } } /// /// 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 individual place a ghost can warp to. /// This is used as part of /// [Serializable, NetSerializable] public struct GhostWarp { public GhostWarp(EntityUid entity, string displayName, bool isWarpPoint) { Entity = entity; DisplayName = displayName; IsWarpPoint = isWarpPoint; } /// /// The entity representing the warp point. /// This is passed back to the server in /// public EntityUid Entity { get; } /// /// The display name to be surfaced in the ghost warps menu /// public string DisplayName { get; } /// /// Whether this warp represents a warp point or a player /// public bool IsWarpPoint { get; } } /// /// 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 warp points. /// 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 EntityUid Target { get; } public GhostWarpToTargetRequestEvent(EntityUid target) { Target = target; } } /// /// 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; } } }