Files
ss14-wl/Content.Shared/Pinpointer/PinpointerComponent.cs
ae6b6811f9 PinpointerSystem&Component cleanup (#42463)
* cleanup

* make some stuff nullable again

* Apply suggestions from code review

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* fix and remove a dependency

---------

Co-authored-by: seanpimble <149889301+seanpimble@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
2026-03-07 14:37:04 +00:00

76 lines
1.7 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Pinpointer;
/// <summary>
/// Displays a sprite on the item that points towards the target component.
/// </summary>
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState]
[Access(typeof(SharedPinpointerSystem))]
public sealed partial class PinpointerComponent : Component
{
// TODO: Type serializer oh god
[DataField]
public string? Component;
[DataField]
public float MediumDistance = 16f;
[DataField]
public float CloseDistance = 8f;
[DataField]
public float ReachedDistance = 1f;
/// <summary>
/// Pinpointer arrow precision in radians.
/// </summary>
[DataField]
public double Precision = 0.09;
/// <summary>
/// Name to display of the target being tracked.
/// </summary>
[DataField]
public string? TargetName;
/// <summary>
/// Whether or not the target name should be updated when the target is updated.
/// </summary>
[DataField]
public bool UpdateTargetName;
/// <summary>
/// Whether or not the target can be reassigned.
/// </summary>
[DataField]
public bool CanRetarget;
[ViewVariables]
public EntityUid? Target = null;
[ViewVariables, AutoNetworkedField]
public bool IsActive = false;
[ViewVariables, AutoNetworkedField]
public Angle ArrowAngle;
[ViewVariables, AutoNetworkedField]
public Distance DistanceToTarget = Distance.Unknown;
[ViewVariables]
public bool HasTarget => DistanceToTarget != Distance.Unknown;
}
[Serializable, NetSerializable]
public enum Distance : byte
{
Unknown,
Reached,
Close,
Medium,
Far
}