public static void Postfix(ref PowerRelay __result)
        {
            if (__result is null)
            {
                return;
            }
            var isCyclops = __result.gameObject.name.Contains("Cyclops");

            if (__result is not BasePowerRelay && !isCyclops)
            {
                return;
            }
            var powerInterface = __result.inboundPowerSources.Where((x) => x is BaseInboundRelay).FirstOrFallback(null);


            PowerControl powerControl;

            if (powerInterface is null)
            {
                var entityRoot = UWE.Utils.GetEntityRoot(__result.gameObject) ?? __result.gameObject;
                powerControl = entityRoot.GetComponentInChildren <PowerControl>();

                if (powerControl?.Relay is null || powerControl.Relay.dontConnectToRelays)
                {
                    return;
                }

                if (isCyclops)
                {
                    __result.AddInboundPower(powerControl.Relay);
                }

                __result = powerControl.Relay;
                return;
            }

            if (powerInterface is not BaseInboundRelay baseInboundRelay || !baseInboundRelay.gameObject.TryGetComponent(out powerControl))
            {
                return;
            }

            if (powerControl.Relay == null || powerControl.Relay.dontConnectToRelays)
            {
                return;
            }

            if (isCyclops)
            {
                __result.AddInboundPower(powerControl.Relay);
            }
            __result = powerControl.Relay;
        }
        private IEnumerator UpdatePowerRelay()
        {
            QuickLogger.Debug("In UpdatePowerRelay");

            var i = 1;

            while (_powerRelay == null)
            {
                QuickLogger.Debug($"Checking For Relay... Attempt {i}");

                PowerRelay relay = PowerSource.FindRelay(this.transform);
                if (relay != null && relay != _powerRelay)
                {
                    _powerRelay = relay;
                    _powerRelay.AddInboundPower(this);
                    QuickLogger.Debug("PowerRelay found");
                }
                else
                {
                    _powerRelay = null;
                }

                i++;
                yield return(new WaitForSeconds(0.5f));
            }
        }
        private void UpdatePowerRelay()
        {
            try
            {
                var relay = PowerSource.FindRelay(transform);

                if (relay != null && relay != _powerRelay)
                {
                    if (_powerRelay != null)
                    {
                        _powerRelay.RemoveInboundPower(this);
                    }
                    _powerRelay = relay;
                    _powerRelay.AddInboundPower(this);
                    CancelInvoke("UpdatePowerRelay");
                }
                else
                {
                    _powerRelay = null;
                }

                if (_powerRelay != null)
                {
                    _powerRelay.RemoveInboundPower(this);
                    _powerRelay.AddInboundPower(this);
                    CancelInvoke("UpdatePowerRelay");
                }
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
            }
        }
        public static void Postfix(ref PowerRelay __result)
        {
            PowerControl powerControl;
            bool         isCyclops = __result?.gameObject.name.Contains("Cyclops") ?? false;

            if (__result != null && (__result is BasePowerRelay || isCyclops))
            {
                IPowerInterface powerInterface = __result.inboundPowerSources.Where((x) => x is BaseInboundRelay)?.FirstOrFallback(null);

                if (powerInterface is null)
                {
                    powerControl = UWE.Utils.GetEntityRoot(__result.gameObject).GetComponentInChildren <PowerControl>();

                    if (powerControl?.powerRelay != null && !powerControl.powerRelay.dontConnectToRelays)
                    {
                        if (isCyclops)
                        {
                            __result.AddInboundPower(powerControl.powerRelay);
                        }
                        __result = powerControl.powerRelay;
                        return;
                    }
                    return;
                }

                BaseInboundRelay baseInboundRelay = powerInterface as BaseInboundRelay;

                if (baseInboundRelay.gameObject.TryGetComponent(out powerControl))
                {
                    if (powerControl?.powerRelay != null && !powerControl.powerRelay.dontConnectToRelays)
                    {
                        if (isCyclops)
                        {
                            __result.AddInboundPower(powerControl.powerRelay);
                        }
                        __result = powerControl.powerRelay;
                        return;
                    }
                }
            }
        }