SiliconLawBoundComponent.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using Content.Shared.Actions;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. using Robust.Shared.Serialization;
  5. namespace Content.Shared.Silicons.Laws.Components;
  6. /// <summary>
  7. /// This is used for entities which are bound to silicon laws and can view them.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, Access(typeof(SharedSiliconLawSystem))]
  10. public sealed partial class SiliconLawBoundComponent : Component
  11. {
  12. /// <summary>
  13. /// The last entity that provided laws to this entity.
  14. /// </summary>
  15. [DataField]
  16. public EntityUid? LastLawProvider;
  17. }
  18. /// <summary>
  19. /// Event raised to get the laws that a law-bound entity has.
  20. ///
  21. /// Is first raised on the entity itself, then on the
  22. /// entity's station, then on the entity's grid,
  23. /// before being broadcast.
  24. /// </summary>
  25. /// <param name="Entity"></param>
  26. [ByRefEvent]
  27. public record struct GetSiliconLawsEvent(EntityUid Entity)
  28. {
  29. public EntityUid Entity = Entity;
  30. public SiliconLawset Laws = new();
  31. public bool Handled = false;
  32. }
  33. public sealed partial class ToggleLawsScreenEvent : InstantActionEvent
  34. {
  35. }
  36. [NetSerializable, Serializable]
  37. public enum SiliconLawsUiKey : byte
  38. {
  39. Key
  40. }
  41. [Serializable, NetSerializable]
  42. public sealed class SiliconLawBuiState : BoundUserInterfaceState
  43. {
  44. public List<SiliconLaw> Laws;
  45. public HashSet<string>? RadioChannels;
  46. public SiliconLawBuiState(List<SiliconLaw> laws, HashSet<string>? radioChannels)
  47. {
  48. Laws = laws;
  49. RadioChannels = radioChannels;
  50. }
  51. }