Ejemplo n.º 1
0
        private void OnAfterInteract(EntityUid uid, EmagComponent component, AfterInteractEvent args)
        {
            if (!args.CanReach || args.Target == null)
            {
                return;
            }

            if (_tagSystem.HasTag(args.Target.Value, "EmagImmune"))
            {
                return;
            }

            if (component.Charges <= 0)
            {
                _popupSystem.PopupEntity(Loc.GetString("emag-no-charges"), args.User, Filter.Entities(args.User));
                return;
            }

            var emaggedEvent = new GotEmaggedEvent(args.User);

            RaiseLocalEvent(args.Target.Value, emaggedEvent, false);
            if (emaggedEvent.Handled)
            {
                _popupSystem.PopupEntity(Loc.GetString("emag-success", ("target", Identity.Entity(args.Target.Value, EntityManager))), args.User,
                                         Filter.Entities(args.User), PopupType.Medium);
                _adminLogger.Add(LogType.Emag, LogImpact.High, $"{ToPrettyString(args.User):player} emagged {ToPrettyString(args.Target.Value):target}");
                component.Charges--;
                return;
            }
        }
 private void OnEmagged(EntityUid uid, AccessReaderComponent reader, GotEmaggedEvent args)
 {
     if (reader.Enabled == true)
     {
         reader.Enabled = false;
         args.Handled   = true;
     }
 }
Ejemplo n.º 3
0
 private void OnEmagged(EntityUid uid, ApcComponent comp, GotEmaggedEvent args)
 {
     if (!comp.Emagged)
     {
         comp.Emagged = true;
         args.Handled = true;
     }
 }
 private void OnEmagged(EntityUid uid, ReagentDispenserComponent comp, GotEmaggedEvent args)
 {
     if (!comp.AlreadyEmagged)
     {
         comp.AddFromPrototype(comp.EmagPackPrototypeId);
         comp.AlreadyEmagged = true;
         args.Handled        = true;
     }
 }
Ejemplo n.º 5
0
 private void OnEmagged(EntityUid uid, RecyclerComponent component, GotEmaggedEvent args)
 {
     if (!component.Safe)
     {
         return;
     }
     component.Safe = false;
     args.Handled   = true;
 }
Ejemplo n.º 6
0
 private void OnEmagged(EntityUid uid, StasisBedComponent component, GotEmaggedEvent args)
 {
     // Repeatable
     // Reset any metabolisms first so they receive the multiplier correctly
     UpdateMetabolisms(uid, component, false);
     component.Multiplier = 1 / component.Multiplier;
     UpdateMetabolisms(uid, component, true);
     args.Handled = true;
 }
        private void OnEmagged(EntityUid uid, VendingMachineComponent component, GotEmaggedEvent args)
        {
            if (component.Emagged || component.EmaggedInventory.Count == 0)
            {
                return;
            }

            component.Emagged = true;
            args.Handled      = true;
        }
Ejemplo n.º 8
0
 private void OnEmagged(EntityUid uid, FireAlarmComponent component, GotEmaggedEvent args)
 {
     if (TryComp <AtmosMonitorComponent>(uid, out var atmosMonitor))
     {
         if (atmosMonitor?.MonitorFire == true)
         {
             atmosMonitor.MonitorFire = false;
             _monitorSystem.Alert(uid, AtmosMonitorAlarmType.Emagged);
             args.Handled = true;
         }
     }
 }
Ejemplo n.º 9
0
        private void OnEmagged(EntityUid uid, LockComponent component, GotEmaggedEvent args)
        {
            if (component.Locked == true)
            {
                if (component.UnlockSound != null)
                {
                    SoundSystem.Play(Filter.Pvs(component.Owner), component.UnlockSound.GetSound(), component.Owner, AudioParams.Default.WithVolume(-5));
                }

                if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComp))
                {
                    appearanceComp.SetData(StorageVisuals.Locked, false);
                }
                EntityManager.RemoveComponent <LockComponent>(uid); //Literally destroys the lock as a tell it was emagged
                args.Handled = true;
            }
        }