/// <summary>
        /// Subscribes/Unsubscribes a transmitter to this component. Returns whether it was successful.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="transmitter"></param>
        /// <returns></returns>
        public bool Interact(IEntity user, SignalTransmitterComponent transmitter)
        {
            if (transmitter == null)
            {
                user.PopupMessage(Loc.GetString("Signal not set."));
                return(false);
            }

            if (_transmitters.Contains(transmitter))
            {
                Unsubscribe(transmitter);
                Owner.PopupMessage(user, Loc.GetString("Unlinked."));
                return(true);
            }

            if (transmitter.Range > 0 && !Owner.Transform.Coordinates.InRange(Owner.EntityManager, transmitter.Owner.Transform.Coordinates, transmitter.Range))
            {
                Owner.PopupMessage(user, Loc.GetString("Out of range."));
                return(false);
            }

            if (!Subscribe(transmitter))
            {
                Owner.PopupMessage(user, Loc.GetString("Max Transmitters reached!"));
                return(false);
            }
            Owner.PopupMessage(user, Loc.GetString("Linked!"));
            return(true);
        }
        /// <summary>
        /// Subscribes/Unsubscribes a transmitter to this component. Returns whether it was successful.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="transmitter"></param>
        /// <returns></returns>
        public bool Interact(IEntity user, SignalTransmitterComponent transmitter)
        {
            if (transmitter == null)
            {
                user.PopupMessage(Loc.GetString("Signal not set."));
                return(false);
            }

            if (_transmitters.Contains(transmitter))
            {
                Unsubscribe(transmitter);
                Owner.PopupMessage(user, Loc.GetString("Unlinked."));
                return(true);
            }

            if (transmitter.Range > 0 && !Owner.Transform.GridPosition.InRange(_mapManager, transmitter.Owner.Transform.GridPosition, transmitter.Range))
            {
                Owner.PopupMessage(user, Loc.GetString("Out of range."));
                return(false);
            }

            Subscribe(transmitter);
            Owner.PopupMessage(user, Loc.GetString("Linked!"));
            return(true);
        }
        public void Subscribe(SignalTransmitterComponent transmitter)
        {
            if (_transmitters.Contains(transmitter))
            {
                return;
            }

            transmitter.Subscribe(this);
            _transmitters.Add(transmitter);
        }
        public bool Subscribe(SignalTransmitterComponent transmitter)
        {
            if (_transmitters.Contains(transmitter))
            {
                return(true);
            }

            if (_transmitters.Count >= _maxTransmitters)
            {
                return(false);
            }

            transmitter.Subscribe(this);
            _transmitters.Add(transmitter);
            return(true);
        }
 public void Unsubscribe(SignalTransmitterComponent transmitter)
 {
     transmitter.Unsubscribe(this);
     _transmitters.Remove(transmitter);
 }
        public override void Initialize()
        {
            base.Initialize();

            Link = null;
        }