using Content.Shared.ProximityDetection.Systems; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; namespace Content.Shared.ProximityDetection.Components; /// /// Used to search for the closest entity with a range that matches specified requirements (tags and/or components). /// [RegisterComponent, NetworkedComponent] [AutoGenerateComponentState(fieldDeltas: true), AutoGenerateComponentPause] [Access(typeof(ProximityDetectionSystem))] public sealed partial class ProximityDetectorComponent : Component { /// /// Entities that detector will search for. /// [DataField(required: true)] public ComponentRegistry Components; /// /// The entity that was found. /// [ViewVariables, AutoNetworkedField] public EntityUid? Target; /// /// The distance to . /// [ViewVariables, AutoNetworkedField] public float Distance = float.PositiveInfinity; /// /// The farthest distance to search for targets. /// [DataField, AutoNetworkedField] public float Range = 10f; /// /// How often detector updates. /// [DataField, AutoNetworkedField] public TimeSpan UpdateCooldown = TimeSpan.FromSeconds(1); /// /// Next time detector updates. /// [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField, AutoPausedField] public TimeSpan NextUpdate = TimeSpan.Zero; }