using System.Linq;
using System.Numerics;
using Robust.Shared.Serialization;
namespace Content.Shared._NF.Radar;
///
/// The shape of the radar blip.
///
[Serializable, NetSerializable]
public enum RadarBlipShape
{
/// Circle shape.
Circle,
/// Square shape.
Square,
/// Triangle shape.
Triangle,
/// Star shape.
Star,
/// Diamond shape.
Diamond,
/// Hexagon shape.
Hexagon,
/// Arrow shape.
Arrow
}
///
/// Event sent from the server to the client containing radar blip data.
///
[Serializable, NetSerializable]
public sealed class GiveBlipsEvent : EntityEventArgs
{
///
/// Blips are now (grid entity, position, scale, color, shape).
/// If grid entity is null, position is in world coordinates.
/// If grid entity is not null, position is in grid-local coordinates.
///
public readonly List<(NetEntity? Grid, Vector2 Position, float Scale, Color Color, RadarBlipShape Shape)> Blips;
///
/// Backwards-compatible constructor for legacy blip format.
///
/// List of blips as (position, scale, color).
public GiveBlipsEvent(List<(Vector2, float, Color)> blips)
{
Blips = blips.Select(b => ((NetEntity?)null, b.Item1, b.Item2, b.Item3, RadarBlipShape.Circle)).ToList();
}
///
/// Constructor for the full blip format.
///
/// List of blips as (grid, position, scale, color, shape).
public GiveBlipsEvent(List<(NetEntity? Grid, Vector2 Position, float Scale, Color Color, RadarBlipShape Shape)> blips)
{
Blips = blips;
}
}
///
/// A request for radar blips around a given entity.
/// Entity must have the RadarConsoleComponent to receive a response.
/// Requests are rate-limited server-side, unhandled messages will not receive a response.
///
[Serializable, NetSerializable]
public sealed class RequestBlipsEvent : EntityEventArgs
{
///
/// The radar entity for which blips are being requested.
///
public readonly NetEntity Radar;
///
/// Constructor for RequestBlipsEvent.
///
/// The radar entity.
public RequestBlipsEvent(NetEntity radar)
{
Radar = radar;
}
}