ChatUser.cs 977 B

12345678910111213141516171819202122232425262728293031323334
  1. using Content.Shared.Chat;
  2. namespace Content.Server.Chat;
  3. public sealed class ChatUser
  4. {
  5. /// <summary>
  6. /// The unique key associated with this chat user, starting from 1 and incremented.
  7. /// Used when the server sends <see cref="MsgChatMessage"/>.
  8. /// Used on the client to delete messages sent by this user when receiving
  9. /// <see cref="MsgDeleteChatMessagesBy"/>.
  10. /// </summary>
  11. public readonly int Key;
  12. /// <summary>
  13. /// All entities that this chat user was attached to while sending chat messages.
  14. /// Sent to the client to delete messages sent by those entities when receiving
  15. /// <see cref="MsgDeleteChatMessagesBy"/>.
  16. /// </summary>
  17. public readonly HashSet<NetEntity> Entities = new();
  18. public ChatUser(int key)
  19. {
  20. Key = key;
  21. }
  22. public void AddEntity(NetEntity entity)
  23. {
  24. if (!entity.Valid)
  25. return;
  26. Entities.Add(entity);
  27. }
  28. }