using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.Pinpointer; /// /// Displays a sprite on the item that points towards the target component. /// [RegisterComponent, NetworkedComponent] [AutoGenerateComponentState] [Access(typeof(SharedPinpointerSystem))] public sealed partial class PinpointerComponent : Component { // TODO: Type serializer oh god [DataField("component"), ViewVariables(VVAccess.ReadWrite)] public string? Component; [DataField("mediumDistance"), ViewVariables(VVAccess.ReadWrite)] public float MediumDistance = 16f; [DataField("closeDistance"), ViewVariables(VVAccess.ReadWrite)] public float CloseDistance = 8f; [DataField("reachedDistance"), ViewVariables(VVAccess.ReadWrite)] public float ReachedDistance = 1f; /// /// Pinpointer arrow precision in radians. /// [DataField("precision"), ViewVariables(VVAccess.ReadWrite)] public double Precision = 0.09; /// /// Name to display of the target being tracked. /// [DataField("targetName"), ViewVariables(VVAccess.ReadWrite)] public string? TargetName; /// /// Whether or not the target name should be updated when the target is updated. /// [DataField("updateTargetName"), ViewVariables(VVAccess.ReadWrite)] public bool UpdateTargetName; /// /// Whether or not the target can be reassigned. /// [DataField("canRetarget"), ViewVariables(VVAccess.ReadWrite)] 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; // Frontier: Frontier-specific fields // If greater than 0, the pinpointer stops pointing to its target when it's further away than this many meters. [DataField] public float MaxRange = -1; // Time in seconds to retarget. [DataField] public float RetargetDoAfter = 15f; // Whether this pinpointer can target mobs. [DataField] public bool CanTargetMobs = false; // Whether this pinpointer's target knows about the pinpointer using the PinpointerTargetComponent. [DataField] public bool SetsTarget = false; // End Frontier: extra pinpointer fields } [Serializable, NetSerializable] public enum Distance : byte { Unknown, Reached, Close, Medium, Far }