public void SetEnabled(EntityUid uid, bool enabled, AdvertiseComponent?advertise = null)
        {
            if (!Resolve(uid, ref advertise))
            {
                return;
            }

            var attemptEvent = new AdvertiseEnableChangeAttemptEvent(enabled, advertise.Enabled);

            RaiseLocalEvent(uid, attemptEvent, false);

            if (attemptEvent.Cancelled)
            {
                return;
            }

            if (enabled)
            {
                RefreshTimer(uid, !advertise.Enabled, advertise);
            }

            advertise.Enabled = enabled;
        }
 private void OnVendingEnableChangeAttempt(EntityUid uid, VendingMachineComponent component, AdvertiseEnableChangeAttemptEvent args)
 {
     // TODO: Improve this...
     if (args.NewState && component.Broken)
     {
         args.Cancel();
     }
 }
 private void OnPowerReceiverEnableChangeAttempt(EntityUid uid, ApcPowerReceiverComponent component, AdvertiseEnableChangeAttemptEvent args)
 {
     if (args.NewState && !component.Powered)
     {
         args.Cancel();
     }
 }