Files
wwdpublic/Content.Shared/DeltaV/NanoChat/NanoChatCardComponent.cs
Will-Oliver-Br d29faf2e85 Port Nanochat Lookup (#1978)
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

Port nanochat lookup from Delta-v.
Pr: https://github.com/DeltaV-Station/Delta-v/pull/2794

---

# TODO

<!--
A list of everything you have to do before this PR is "complete"
You probably won't have to complete everything before merging but it's
good to leave future references
-->

- [x] Task
- [x] Completed Task

---

<!--
This is default collapsed, readers click to expand it and see all your
media
The PR media section can get very large at times, so this is a good way
to keep it clean
The title is written using HTML tags
The title must be within the <summary> tags or you won't see it
-->

<details><summary><h1>Media</h1></summary>
<p>

![Captura de tela 2025-03-16
183052](https://github.com/user-attachments/assets/2b844906-4117-4560-9045-69b9d5493cf3)
![Captura de tela 2025-03-16
183117](https://github.com/user-attachments/assets/b2546750-c808-468e-8fbf-de1d75402c06)
![Captura de tela 2025-03-16
183124](https://github.com/user-attachments/assets/01c5eb53-b1ba-4ca7-8a2e-f1813147b441)
![Captura de tela 2025-03-16
183147](https://github.com/user-attachments/assets/304ac291-b5b0-474f-84c3-8321386c02e2)

</p>
</details>

---

# Changelog

<!--
You can add an author after the `🆑` to change the name that appears
in the changelog (ex: `🆑 Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

🆑 Toby222 and Will-Oliver-Br
add: Add Number lookup to NanoChat

---------

Co-authored-by: Tobias Berger <toby@tobot.dev>

(cherry picked from commit c3b6aeda090719cf82b132dcadebbe035a0da45a)
2025-03-21 16:50:22 +03:00

63 lines
1.9 KiB
C#

using Content.Shared.DeltaV.CartridgeLoader.Cartridges;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.DeltaV.NanoChat;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedNanoChatSystem))]
[AutoGenerateComponentPause, AutoGenerateComponentState]
public sealed partial class NanoChatCardComponent : Component
{
/// <summary>
/// The number assigned to this card.
/// </summary>
[DataField, AutoNetworkedField]
public uint? Number;
/// <summary>
/// All chat recipients stored on this card.
/// </summary>
[DataField]
public Dictionary<uint, NanoChatRecipient> Recipients = new();
/// <summary>
/// All messages stored on this card, keyed by recipient number.
/// </summary>
[DataField]
public Dictionary<uint, List<NanoChatMessage>> Messages = new();
/// <summary>
/// The currently selected chat recipient number.
/// </summary>
[DataField]
public uint? CurrentChat;
/// <summary>
/// The maximum amount of recipients this card supports.
/// </summary>
[DataField]
public int MaxRecipients = 50;
/// <summary>
/// Last time a message was sent, for rate limiting.
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
public TimeSpan LastMessageTime; // TODO: actually use this, compare against actor and not the card
/// <summary>
/// Whether to send notifications.
/// </summary>
[DataField]
public bool NotificationsMuted;
/// <summary>
/// The PDA that this card is currently inserted to.
/// </summary>
[DataField]
public EntityUid? PdaUid = null;
/// Whether the card's number should be listed in NanoChat's lookup
/// </summary>
[DataField]
public bool ListNumber = true;
}