1
0

AlertsComponent.cs 907 B

1234567891011121314151617181920212223242526272829
  1. using Robust.Shared.GameStates;
  2. using Robust.Shared.Serialization;
  3. namespace Content.Shared.Alert;
  4. /// <summary>
  5. /// Handles the icons on the right side of the screen.
  6. /// Should only be used for player-controlled entities.
  7. /// </summary>
  8. // Component is not AutoNetworked due to supporting clientside-only alerts.
  9. // Component state is handled manually to avoid the server overwriting the client list.
  10. [RegisterComponent, NetworkedComponent]
  11. public sealed partial class AlertsComponent : Component
  12. {
  13. [ViewVariables]
  14. public Dictionary<AlertKey, AlertState> Alerts = new();
  15. public override bool SendOnlyToOwner => true;
  16. }
  17. [Serializable, NetSerializable]
  18. public sealed class AlertComponentState : ComponentState
  19. {
  20. public Dictionary<AlertKey, AlertState> Alerts { get; }
  21. public AlertComponentState(Dictionary<AlertKey, AlertState> alerts)
  22. {
  23. Alerts = alerts;
  24. }
  25. }