Use EntityUID for all ghost warps (#11113)

This commit is contained in:
Illiux
2022-09-10 14:47:17 -07:00
committed by GitHub
parent 4cc5fa239e
commit acd24bed4d
4 changed files with 77 additions and 138 deletions

View File

@@ -43,6 +43,35 @@ namespace Content.Shared.Ghost
{
}
/// <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(EntityUid 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 EntityUid 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
@@ -50,38 +79,15 @@ namespace Content.Shared.Ghost
[Serializable, NetSerializable]
public sealed class GhostWarpsResponseEvent : EntityEventArgs
{
public GhostWarpsResponseEvent(List<string> locations, Dictionary<EntityUid, string> players)
public GhostWarpsResponseEvent(List<GhostWarp> warps)
{
Locations = locations;
Players = players;
Warps = warps;
}
/// <summary>
/// A list of location names that can be warped to.
/// A list of warp points.
/// </summary>
public List<string> Locations { get; }
/// <summary>
/// A dictionary containing the entity id, and name of players that can be warped to.
/// </summary>
public Dictionary<EntityUid, string> Players { get; }
}
/// <summary>
/// A client to server request for their ghost to be warped to a location
/// </summary>
[Serializable, NetSerializable]
public sealed class GhostWarpToLocationRequestEvent : EntityEventArgs
{
/// <summary>
/// The location name to warp to.
/// </summary>
public string Name { get; }
public GhostWarpToLocationRequestEvent(string locationName)
{
Name = locationName;
}
public List<GhostWarp> Warps { get; }
}
/// <summary>