Various Improvements to NanoChat (#2922)

* Port improvements to NanoChat from Einstein-Engines and Goob-Station

* fix duplicate translation key

* add missing space

* Properly mark DeltaV changes

* Allow muting individual NanoChat users, NanoChat UI to put per-chat buttons next to the message box

* remove leftover from testing stuff

* cycle through inputs with tab, confirm with enter; for new and edit chat

* Add channel switching with (Shift+)Alt+Up/Down; Discord-Style

* better null check

* another better null check

* Implement changes from ImpStation PR

* Rename ContactControl -> ContactContainer

* Requested changes

* Move Loc to _DV, don't register system as manager

* I'm so smart :)

---------

Co-authored-by: Alex C <alex91905@yahoo.com>
This commit is contained in:
Tobias Berger
2025-02-23 15:59:24 +00:00
committed by GitHub
co-authored by Alex C
parent 4d81b48dd3
commit 4ecf2aaca2
21 changed files with 604 additions and 97 deletions
@@ -7,6 +7,8 @@ using Content.Shared._DV.CartridgeLoader.Cartridges;
using Content.Shared._DV.NanoChat;
using Content.Shared.Kitchen.Components;
using Content.Shared.NameIdentifier;
using Content.Shared.PDA;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -26,10 +28,32 @@ public sealed class NanoChatSystem : SharedNanoChatSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<NanoChatCardComponent, EntGotInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<NanoChatCardComponent, EntGotRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<NanoChatCardComponent, MapInitEvent>(OnCardInit);
SubscribeLocalEvent<NanoChatCardComponent, BeingMicrowavedEvent>(OnMicrowaved, after: [typeof(IdCardSystem)]);
}
private void OnInserted(Entity<NanoChatCardComponent> ent, ref EntGotInsertedIntoContainerMessage args)
{
if (args.Container.ID != PdaComponent.PdaIdSlotId)
return;
ent.Comp.PdaUid = args.Container.Owner;
Dirty(ent);
}
private void OnRemoved(Entity<NanoChatCardComponent> ent, ref EntGotRemovedFromContainerMessage args)
{
if (args.Container.ID != PdaComponent.PdaIdSlotId)
return;
ent.Comp.PdaUid = null;
Dirty(ent);
}
private void OnMicrowaved(Entity<NanoChatCardComponent> ent, ref BeingMicrowavedEvent args)
{
// Skip if the entity was deleted (e.g., by ID card system burning it)