CatStation/Content.Shared/Chat/SharedChatEvents.cs
cashew 4bde1c1120
Port Chat Follow functionality from AfterLight (#45375)
* ports chat follow function from AL and removes PJB implementation
forgor to commit earlier so it's just one chunk

* fixes accidental MiscTab.xaml restructuring

* fix name color

* remove unused function

* cvar summary

* typo

* accidental doc removal

* fix test fail

* fix test fail

* like i said first pr :|

* inject in constructor

* adds chat links to Local, Whisper, LOOC and Dead Chat respects Admin ghost privacy

* i hate chat code

* remove cvar

* single events file

* adds CanGhostWarp back

* filter for admin ghosts

* move tag

* remove ChatLinkTag.cs

* fix speechbubble rendering

* i want to bash my brain in

* kill chatcode

* formatting

* testfail

* still not working

* atleast deadchat works now

* even prettier TextLinkTag.cs

* fix speechbubble rendering for looc

* docs

* renaming and better docs

* Revert "remove cvar"

This reverts commit 1acb168f

* final changes (hopefully)

* requested changes

* can't parse -

* change TextLinkTag again

* formatting and typo

Co-authored-by: Connor Huffine <chuffine@gmail.com>

* quickfix

* no logging for now actually

* i will work on this in the morning

* restructuring

* wip

* final restructuring and docs

* still not done btw

* review

* docfix

* actually we can filter for admin ghosts

* doc

* fix color

* fix fix color

* review

* all I care to clean up

* bold names

* doc

* admin warp

* fixed

* fsaasffsa

* GOD ONCE SAID: GOOD ENOUGH

* they call me the shuffler

* admin chat links

* forgor newline

* fix?

* actual fix

* dumb stuff

* chungus

---------

Co-authored-by: Connor Huffine <chuffine@gmail.com>
Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
2026-09-15 08:05:17 +00:00

99 lines
3.1 KiB
C#

using Content.Shared.Inventory;
using Content.Shared.Radio;
using Content.Shared.Speech;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Chat;
/// <summary>
/// This event should be sent everytime an entity talks (Radio, local chat, etc...).
/// The event is sent to both the entity itself, and all clothing (For stuff like voice masks).
/// </summary>
public sealed class TransformSpeakerNameEvent : EntityEventArgs, IInventoryRelayEvent
{
public SlotFlags TargetSlots { get; } = SlotFlags.WITHOUT_POCKET;
public EntityUid Sender;
public string VoiceName;
public ProtoId<SpeechVerbPrototype>? SpeechVerb;
public TransformSpeakerNameEvent(EntityUid sender, string name)
{
Sender = sender;
VoiceName = name;
SpeechVerb = null;
}
}
/// <summary>
/// Raised broadcast in order to transform speech.transmit
/// </summary>
public sealed class TransformSpeechEvent : CancellableEntityEventArgs, IInventoryRelayEvent
{
public SlotFlags TargetSlots { get; } = SlotFlags.WITHOUT_POCKET;
public EntityUid Sender;
public string Message;
public TransformSpeechEvent(EntityUid sender, string message)
{
Sender = sender;
Message = message;
}
}
public sealed class CheckIgnoreSpeechBlockerEvent : EntityEventArgs
{
public EntityUid Sender;
public bool IgnoreBlocker;
public CheckIgnoreSpeechBlockerEvent(EntityUid sender, bool ignoreBlocker)
{
Sender = sender;
IgnoreBlocker = ignoreBlocker;
}
}
/// <summary>
/// Raised on an entity when it speaks, either through 'say' or 'whisper'.
/// </summary>
public sealed class EntitySpokeEvent : EntityEventArgs
{
public readonly EntityUid Source;
public readonly string Message;
public readonly string? ObfuscatedMessage; // not null if this was a whisper
/// <summary>
/// If the entity was trying to speak into a radio, this was the channel they were trying to access. If a radio
/// message gets sent on this channel, this should be set to null to prevent duplicate messages.
/// </summary>
public RadioChannelPrototype? Channel;
public EntitySpokeEvent(EntityUid source, string message, RadioChannelPrototype? channel, string? obfuscatedMessage)
{
Source = source;
Message = message;
Channel = channel;
ObfuscatedMessage = obfuscatedMessage;
}
}
/// <summary>
/// Checks if an entity link can be clicked on or not, so that it may be teleported to.
/// </summary>
/// <param name="Target">Target we are attempting to teleport to.</param>
/// <param name="Pure">If pure is true, will only act as an attempt event. If pure is false, will teleport to the entity.</param>
[ByRefEvent]
public record struct ClickEntityLinkEvent(EntityUid Target, bool Pure)
{
public bool Handled;
}
/// <summary>
/// Net Message that is sent when a client clicks a link in the chat box.
/// </summary>
/// <param name="target">Target entity of the text link</param>
[Serializable, NetSerializable]
public sealed class ChatLinkClickedRequestEvent(NetEntity target) : EntityEventArgs
{
public readonly NetEntity Target = target;
}