mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 02:21:08 +03:00
parent
e927a6d1c4
commit
c86c92c5cf
49 changed files with 291 additions and 282 deletions
|
|
@ -5,7 +5,7 @@ using Content.Client.Administration.Systems;
|
|||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Client.Graphics;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Content.Client.Movement.Systems;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Content.Shared.NightVision;
|
||||
using Content.Shared.Overlays;
|
||||
using Robust.Client.Console;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Content.Shared.StatusIcon.Components;
|
||||
using Content.Shared.Stealth.Components;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using Content.Client.Gameplay;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Ghost;
|
||||
using Content.Client.UserInterface.Systems.Gameplay;
|
||||
using Content.Client.UserInterface.Systems.Ghost.Widgets;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Content.Client.Stylesheets;
|
|||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Content.Shared.Voting;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Content.Shared.Damage.Prototypes;
|
|||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.Execution;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Mind;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#nullable enable
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Fixtures;
|
||||
using Content.Server.Ghost.Roles;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Shared.Console;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Numerics;
|
||||
using System.Numerics;
|
||||
using Content.IntegrationTests.Fixtures;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.GameObjects;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.Console;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Pair;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Players;
|
||||
using Robust.Server.GameObjects;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Linq;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ using Content.Server.GameTicking;
|
|||
using Content.Server.Ghost;
|
||||
using Content.Server.Mind;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Content.Shared.Mind;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Warps;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Enums;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server.Antag.Components;
|
||||
using Content.Server.GameTicking.Rules.Components;
|
||||
using Content.Shared.Antag;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Players;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using Content.Server.Antag.Selectors;
|
|||
using Content.Shared.Antag;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.GameTicking.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Roles;
|
||||
using JetBrains.Annotations;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Speech.Prototypes;
|
||||
using Robust.Shared.Console;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using Content.Shared.CCVar;
|
|||
using Content.Shared.Chat;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Players.RateLimiting;
|
||||
using Content.Shared.Speech.EntitySystems;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ using Content.Shared.Eui;
|
|||
using Content.Shared.Fax.Components;
|
||||
using Content.Shared.Fax;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Paper;
|
||||
using Content.Shared.DeviceNetwork.Components;
|
||||
using Content.Shared.Ghost.Components;
|
||||
|
||||
namespace Content.Server.Fax.AdminUI;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ using Content.Shared.Eye;
|
|||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Follower;
|
||||
using Content.Shared.Follower.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Content.Shared.GhostTypes;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ using Content.Shared.Verbs;
|
|||
using Robust.Shared.Collections;
|
||||
using Content.Shared.Ghost.Roles.Components;
|
||||
using Content.Shared.Roles.Components;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Content.Shared.Ghost.Components;
|
||||
|
||||
namespace Content.Server.Ghost.Roles;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Content.Server.Administration.Logs;
|
|||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Players;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Content.Server.Ghost.Roles.Components;
|
|||
using Content.Server.Shuttles.Events;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Parallax.Biomes;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using Content.Shared.CCVar;
|
|||
using Content.Shared.Database;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Eye;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.IdentityManagement;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.NameModifier.EntitySystems;
|
||||
using Content.Shared.Roles.Components;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Teleportation.Systems;
|
||||
using Robust.Shared.Map;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using Content.Server.Maps;
|
|||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Content.Shared.Voting;
|
||||
using Robust.Server.Player;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Content.Server.GameTicking;
|
|||
using Content.Server.Ghost;
|
||||
using Content.Server.Roles.Jobs;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Voting;
|
||||
using Robust.Server.Player;
|
||||
|
|
@ -15,6 +14,7 @@ using Robust.Shared.Timing;
|
|||
using System.Threading.Tasks;
|
||||
using Content.Server.Players.Whitelist;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
using Content.Shared.Ghost.Components;
|
||||
|
||||
namespace Content.Server.Voting;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Robust.Shared.Containers;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.EntityConditions.Conditions.Generic;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Linq;
|
||||
using Content.Shared.Eye.Blinding.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using System.Numerics;
|
|||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Follower.Components;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Movement.Pulling.Events;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
using Content.Shared.Actions;
|
||||
using Content.Shared.Ghost.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Ghost;
|
||||
namespace Content.Shared.Ghost.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an observer ghost.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Content.Shared.Ghost;
|
||||
namespace Content.Shared.Ghost.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for marking entities which should receive all local chat message, even when out of range
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Ghost;
|
||||
namespace Content.Shared.Ghost.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class GhostOnMoveComponent : Component
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Ghost;
|
||||
namespace Content.Shared.Ghost.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Marker component to identify "ghostly" entities.
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
using Content.Shared.Emoting;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Ghost
|
||||
{
|
||||
/// <summary>
|
||||
/// System for the <see cref="GhostComponent"/>.
|
||||
/// Prevents ghosts from interacting when <see cref="GhostComponent.CanGhostInteract"/> is false.
|
||||
/// </summary>
|
||||
public abstract partial class SharedGhostSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected SharedPopupSystem Popup = default!;
|
||||
[Dependency] protected IGameTiming _gameTiming = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<GhostComponent, UseAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, InteractionAttemptEvent>(OnAttemptInteract);
|
||||
SubscribeLocalEvent<GhostComponent, EmoteAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, DropAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, PickupAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, ExaminedEvent>(OnGhostExamine);
|
||||
}
|
||||
|
||||
private void OnGhostExamine(EntityUid uid, GhostComponent component, ExaminedEvent args)
|
||||
{
|
||||
var timeSinceDeath = _gameTiming.RealTime.Subtract(component.TimeOfDeath);
|
||||
var deathTimeInfo = timeSinceDeath.Minutes > 0
|
||||
? Loc.GetString("comp-ghost-examine-time-minutes", ("minutes", timeSinceDeath.Minutes))
|
||||
: Loc.GetString("comp-ghost-examine-time-seconds", ("seconds", timeSinceDeath.Seconds));
|
||||
|
||||
args.PushMarkup(deathTimeInfo);
|
||||
}
|
||||
|
||||
private void OnAttemptInteract(Entity<GhostComponent> 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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the ghost's time of death.
|
||||
/// </summary>
|
||||
public void SetTimeOfDeath(Entity<GhostComponent?> entity, TimeSpan value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.TimeOfDeath == value)
|
||||
return;
|
||||
|
||||
entity.Comp.TimeOfDeath = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetTimeOfDeath(EntityUid uid, TimeSpan value, GhostComponent? component)
|
||||
{
|
||||
SetTimeOfDeath((uid, component), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether or not the ghost player is allowed to return to their original body.
|
||||
/// </summary>
|
||||
public void SetCanReturnToBody(Entity<GhostComponent?> entity, bool value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.CanReturnToBody == value)
|
||||
return;
|
||||
|
||||
entity.Comp.CanReturnToBody = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetCanReturnToBody(EntityUid uid, bool value, GhostComponent? component = null)
|
||||
{
|
||||
SetCanReturnToBody((uid, component), value);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetCanReturnToBody(GhostComponent component, bool value)
|
||||
{
|
||||
SetCanReturnToBody((component.Owner, component), value);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the ghost is allowed to interact with other entities.
|
||||
/// </summary>
|
||||
public void SetCanGhostInteract(Entity<GhostComponent?> entity, bool value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.CanGhostInteract == value)
|
||||
return;
|
||||
|
||||
entity.Comp.CanGhostInteract = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request to get places a ghost can warp to.
|
||||
/// Response is sent via <see cref="GhostWarpsResponseEvent"/>
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpsRequestEvent : EntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An individual place a ghost can warp to.
|
||||
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public struct GhostWarp
|
||||
{
|
||||
public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
|
||||
{
|
||||
Entity = entity;
|
||||
DisplayName = displayName;
|
||||
IsWarpPoint = isWarpPoint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entity representing the warp point.
|
||||
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
|
||||
/// </summary>
|
||||
public NetEntity Entity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The display name to be surfaced in the ghost warps menu
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this warp represents a warp point or a player
|
||||
/// </summary>
|
||||
public bool IsWarpPoint { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server to client response for a <see cref="GhostWarpsRequestEvent"/>.
|
||||
/// Contains players, and locations a ghost can warp to
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpsResponseEvent : EntityEventArgs
|
||||
{
|
||||
public GhostWarpsResponseEvent(List<GhostWarp> warps)
|
||||
{
|
||||
Warps = warps;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of warp points.
|
||||
/// </summary>
|
||||
public List<GhostWarp> Warps { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to an entity
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs
|
||||
{
|
||||
public NetEntity Target { get; }
|
||||
|
||||
public GhostWarpToTargetRequestEvent(NetEntity target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to the most followed player.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostnadoRequestEvent : EntityEventArgs;
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to a random player with at least one ghost follower.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class WarpToRandomFollowedRequestEvent : EntityEventArgs;
|
||||
/// <summary>
|
||||
|
||||
/// A client to server request for their ghost to be warped to a random player.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class WarpToRandomRequestEvent : EntityEventArgs;
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to return to body
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostReturnToBodyRequest : EntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server to client update with the available ghost role count
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostUpdateGhostRoleCountEvent : EntityEventArgs
|
||||
{
|
||||
public int AvailableGhostRoles { get; }
|
||||
|
||||
public GhostUpdateGhostRoleCountEvent(int availableGhostRoleCount)
|
||||
{
|
||||
AvailableGhostRoles = availableGhostRoleCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
230
Content.Shared/Ghost/Systems/SharedGhostSystem.cs
Normal file
230
Content.Shared/Ghost/Systems/SharedGhostSystem.cs
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
using Content.Shared.Emoting;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared.Ghost.Systems;
|
||||
|
||||
/// <summary>
|
||||
/// System for the <see cref="GhostComponent"/>.
|
||||
/// Prevents ghosts from interacting when <see cref="GhostComponent.CanGhostInteract"/> is false.
|
||||
/// </summary>
|
||||
public abstract partial class SharedGhostSystem : EntitySystem
|
||||
{
|
||||
[Dependency] protected SharedPopupSystem Popup = default!;
|
||||
[Dependency] protected IGameTiming _gameTiming = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<GhostComponent, UseAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, InteractionAttemptEvent>(OnAttemptInteract);
|
||||
SubscribeLocalEvent<GhostComponent, EmoteAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, DropAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, PickupAttemptEvent>(OnAttempt);
|
||||
SubscribeLocalEvent<GhostComponent, ExaminedEvent>(OnGhostExamine);
|
||||
}
|
||||
|
||||
private void OnGhostExamine(EntityUid uid, GhostComponent component, ExaminedEvent args)
|
||||
{
|
||||
var timeSinceDeath = _gameTiming.RealTime.Subtract(component.TimeOfDeath);
|
||||
var deathTimeInfo = timeSinceDeath.Minutes > 0
|
||||
? Loc.GetString("comp-ghost-examine-time-minutes", ("minutes", timeSinceDeath.Minutes))
|
||||
: Loc.GetString("comp-ghost-examine-time-seconds", ("seconds", timeSinceDeath.Seconds));
|
||||
|
||||
args.PushMarkup(deathTimeInfo);
|
||||
}
|
||||
|
||||
private void OnAttemptInteract(Entity<GhostComponent> 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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the ghost's time of death.
|
||||
/// </summary>
|
||||
public void SetTimeOfDeath(Entity<GhostComponent?> entity, TimeSpan value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.TimeOfDeath == value)
|
||||
return;
|
||||
|
||||
entity.Comp.TimeOfDeath = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetTimeOfDeath(EntityUid uid, TimeSpan value, GhostComponent? component)
|
||||
{
|
||||
SetTimeOfDeath((uid, component), value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether or not the ghost player is allowed to return to their original body.
|
||||
/// </summary>
|
||||
public void SetCanReturnToBody(Entity<GhostComponent?> entity, bool value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.CanReturnToBody == value)
|
||||
return;
|
||||
|
||||
entity.Comp.CanReturnToBody = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetCanReturnToBody(EntityUid uid, bool value, GhostComponent? component = null)
|
||||
{
|
||||
SetCanReturnToBody((uid, component), value);
|
||||
}
|
||||
|
||||
[Obsolete("Use the Entity<GhostComponent?> overload")]
|
||||
public void SetCanReturnToBody(GhostComponent component, bool value)
|
||||
{
|
||||
SetCanReturnToBody((component.Owner, component), value);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the ghost is allowed to interact with other entities.
|
||||
/// </summary>
|
||||
public void SetCanGhostInteract(Entity<GhostComponent?> entity, bool value)
|
||||
{
|
||||
if (!Resolve(entity, ref entity.Comp))
|
||||
return;
|
||||
|
||||
if (entity.Comp.CanGhostInteract == value)
|
||||
return;
|
||||
|
||||
entity.Comp.CanGhostInteract = value;
|
||||
Dirty(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request to get places a ghost can warp to.
|
||||
/// Response is sent via <see cref="GhostWarpsResponseEvent"/>
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpsRequestEvent : EntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An individual place a ghost can warp to.
|
||||
/// This is used as part of <see cref="GhostWarpsResponseEvent"/>
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public struct GhostWarp
|
||||
{
|
||||
public GhostWarp(NetEntity entity, string displayName, bool isWarpPoint)
|
||||
{
|
||||
Entity = entity;
|
||||
DisplayName = displayName;
|
||||
IsWarpPoint = isWarpPoint;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entity representing the warp point.
|
||||
/// This is passed back to the server in <see cref="GhostWarpToTargetRequestEvent"/>
|
||||
/// </summary>
|
||||
public NetEntity Entity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The display name to be surfaced in the ghost warps menu
|
||||
/// </summary>
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this warp represents a warp point or a player
|
||||
/// </summary>
|
||||
public bool IsWarpPoint { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server to client response for a <see cref="GhostWarpsRequestEvent"/>.
|
||||
/// Contains players, and locations a ghost can warp to
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpsResponseEvent : EntityEventArgs
|
||||
{
|
||||
public GhostWarpsResponseEvent(List<GhostWarp> warps)
|
||||
{
|
||||
Warps = warps;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of warp points.
|
||||
/// </summary>
|
||||
public List<GhostWarp> Warps { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to an entity
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostWarpToTargetRequestEvent : EntityEventArgs
|
||||
{
|
||||
public NetEntity Target { get; }
|
||||
|
||||
public GhostWarpToTargetRequestEvent(NetEntity target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to the most followed player.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostnadoRequestEvent : EntityEventArgs;
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to be warped to a random player with at least one ghost follower.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class WarpToRandomFollowedRequestEvent : EntityEventArgs;
|
||||
/// <summary>
|
||||
|
||||
/// A client to server request for their ghost to be warped to a random player.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class WarpToRandomRequestEvent : EntityEventArgs;
|
||||
|
||||
/// <summary>
|
||||
/// A client to server request for their ghost to return to body
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostReturnToBodyRequest : EntityEventArgs
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A server to client update with the available ghost role count
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class GhostUpdateGhostRoleCountEvent : EntityEventArgs
|
||||
{
|
||||
public int AvailableGhostRoles { get; }
|
||||
|
||||
public GhostUpdateGhostRoleCountEvent(int availableGhostRoleCount)
|
||||
{
|
||||
AvailableGhostRoles = availableGhostRoleCount;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ using System.Linq;
|
|||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Damage.Systems;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.IdentityManagement.Components;
|
||||
|
||||
namespace Content.Shared.IdentityManagement;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Content.Shared.CCVar;
|
|||
using Content.Shared.Chat;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using System.Numerics;
|
|||
using Content.Shared.Administration;
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Robust.Shared.Input.Binding;
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@ using Robust.Shared.Physics.Collision.Shapes;
|
|||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Content.Shared.Ghost.Components;
|
||||
|
||||
namespace Content.Shared.Singularity.EntitySystems;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Managers;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Content.Shared.Examine;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
|
||||
namespace Content.Shared.Warps;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using Content.Shared.Examine;
|
||||
using Content.Shared.Ghost;
|
||||
using Content.Shared.Ghost.Components;
|
||||
using Content.Shared.Xenoarchaeology.Artifact.Components;
|
||||
using Content.Shared.Xenoarchaeology.Artifact.XAT.Components;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue