protected override void PowernetConnect(object sender, PowernetEventArgs eventarg)
        {
            base.PowernetConnect(sender, eventarg);

            //Find devices within range to take under our control
            var _emanager = IoCManager.Resolve <IServerEntityManager>();
            var position  = Owner.GetComponent <TransformComponent>().WorldPosition;
            var entities  = _emanager.GetEntitiesInRange(Owner, PowerRange)
                            .Where(x => x.HasComponent <PowerDeviceComponent>());


            foreach (var entity in entities)
            {
                var device = entity.GetComponent <PowerDeviceComponent>();

                //Make sure the device can accept power providers to give it power
                if (device.DrawType == DrawTypes.Provider || device.DrawType == DrawTypes.Both)
                {
                    if (!AdvertisedDevices.Contains(device))
                    {
                        device.AddProvider(this);
                        AdvertisedDevices.Add(device);
                    }
                }
            }
        }
        protected override void PowernetDisconnect(object sender, PowernetEventArgs eventarg)
        {
            base.PowernetDisconnect(sender, eventarg);

            //We don't want to make the devices under us think we're still a valid provider if we have no powernet to connect to
            foreach (var device in AdvertisedDevices.ToList())
            {
                device.RemoveProvider(this);
            }
            AdvertisedDevices.Clear();
        }
        private void PowernetDisconnect(object sender, PowernetEventArgs eventarg)
        {
            eventarg.Powernet.RemoveDevice(this);
            Connected = DrawTypes.None;

            //We don't want to make the devices under us think we're still a valid provider if we have no powernet to connect to
            foreach (var device in Deviceloadlist)
            {
                device.RemoveProvider(this);
            }
        }
 private void PowernetRegenerate(object sender, PowernetEventArgs eventarg)
 {
     eventarg.Powernet.AddDevice(this);
 }