SetWiresPanelSecurity.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Content.Shared.Construction;
  2. using Content.Shared.Wires;
  3. using JetBrains.Annotations;
  4. namespace Content.Server.Construction.Completions;
  5. /// <summary>
  6. /// This graph action is used to set values on entities with the <see cref="WiresPanelSecurityComponent"/>
  7. /// </summary>
  8. [UsedImplicitly]
  9. [DataDefinition]
  10. public sealed partial class SetWiresPanelSecurity : IGraphAction
  11. {
  12. /// <summary>
  13. /// Sets the Examine field on the entity's <see cref="WiresPanelSecurityComponent"/>
  14. /// </summary>
  15. [DataField("examine")]
  16. public string Examine = string.Empty;
  17. /// <summary>
  18. /// Sets the WiresAccessible field on the entity's <see cref="WiresPanelSecurityComponent"/>
  19. /// </summary>
  20. [DataField("wiresAccessible")]
  21. public bool WiresAccessible = true;
  22. public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
  23. {
  24. if (entityManager.TryGetComponent(uid, out WiresPanelSecurityComponent? _))
  25. {
  26. var ev = new WiresPanelSecurityEvent(Examine, WiresAccessible);
  27. entityManager.EventBus.RaiseLocalEvent(uid, ev);
  28. }
  29. }
  30. }