Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sublte #14

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"me \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.Subtle: // Floofstation
_consoleHost.ExecuteCommand($"subtle \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.Dead:
if (_systems.GetEntitySystemOrNull<GhostSystem>() is {IsGhost: true})
goto case ChatSelectChannel.Local;
Expand Down Expand Up @@ -76,7 +80,7 @@ public void SendMessage(string text, ChatSelectChannel channel)
throw new ArgumentOutOfRangeException(nameof(channel), channel, null);
}
}
//Nyano - Summary: fires off the update permissions script.
//Nyano - Summary: fires off the update permissions script.
public void UpdatePermissions()
{
PermissionsUpdated?.Invoke();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public sealed class ChatUIController : UIController
{SharedChatSystem.OOCPrefix, ChatSelectChannel.OOC},
{SharedChatSystem.EmotesPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.EmotesAltPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.SubtlePrefix, ChatSelectChannel.Subtle}, // Floofstation
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
Expand All @@ -92,6 +93,7 @@ public sealed class ChatUIController : UIController
{ChatSelectChannel.LOOC, SharedChatSystem.LOOCPrefix},
{ChatSelectChannel.OOC, SharedChatSystem.OOCPrefix},
{ChatSelectChannel.Emotes, SharedChatSystem.EmotesPrefix},
{ChatSelectChannel.Subtle, SharedChatSystem.SubtlePrefix}, // Floofstation
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
Expand Down Expand Up @@ -496,6 +498,7 @@ private void UpdateChannelPermissions()
FilterableChannels |= ChatChannel.Whisper;
FilterableChannels |= ChatChannel.Radio;
FilterableChannels |= ChatChannel.Emotes;
FilterableChannels |= ChatChannel.Subtle; // Floofstation
FilterableChannels |= ChatChannel.Notifications;

// Can only send local / radio / emote when attached to a non-ghost entity.
Expand All @@ -506,6 +509,7 @@ private void UpdateChannelPermissions()
CanSendChannels |= ChatSelectChannel.Whisper;
CanSendChannels |= ChatSelectChannel.Radio;
CanSendChannels |= ChatSelectChannel.Emotes;
CanSendChannels |= ChatSelectChannel.Subtle; // Floofstation
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ public sealed class ChannelSelectorPopup : Popup
ChatSelectChannel.Local,
ChatSelectChannel.Whisper,
ChatSelectChannel.Emotes,
ChatSelectChannel.Subtle, // Floofstation
ChatSelectChannel.Radio,
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
ChatSelectChannel.LOOC,
ChatSelectChannel.OOC,
ChatSelectChannel.Dead,
Expand Down
43 changes: 43 additions & 0 deletions Content.Server/Chat/Commands/SubtleCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.Enums;

namespace Content.Server.Chat.Commands
{
[AnyCommand]
internal sealed class SubtleCommand : IConsoleCommand
{
public string Command => "subtle";
public string Description => "Perform an subtle action.";
public string Help => "subtle <text>";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;
}

if (player.Status != SessionStatus.InGame)
return;

if (player.AttachedEntity is not {} playerEntity)
{
shell.WriteError("You don't have an entity!");
return;
}

if (args.Length < 1)
return;

var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;

IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Subtle, ChatTransmitRange.NoGhosts, false, shell, player);
}
}
}
45 changes: 45 additions & 0 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public void TrySendInGameICMessage(
case InGameICChatType.Emote:
SendEntityEmote(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
break;
case InGameICChatType.Subtle:
SendEntitySubtle(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
break;
//Nyano - Summary: case adds the telepathic chat sending ability.
case InGameICChatType.Telepathic:
_nyanoChatSystem.SendTelepathicChat(source, message, range == ChatTransmitRange.HideChat);
Expand Down Expand Up @@ -596,6 +599,47 @@ private void SendEntityEmote(
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user}: {action}");
}

private void SendEntitySubtle(
EntityUid source,
string action,
ChatTransmitRange range,
string? nameOverride,
bool hideLog = false,
bool ignoreActionBlocker = false,
NetUserId? author = null
)
{
if (!_actionBlocker.CanEmote(source) && !ignoreActionBlocker)
return;

// get the entity's apparent name (if no override provided).
var ent = Identity.Entity(source, EntityManager);
string name = FormattedMessage.EscapeText(nameOverride ?? Name(ent));

// Emotes use Identity.Name, since it doesn't actually involve your voice at all.
var wrappedMessage = Loc.GetString("chat-manager-entity-subtle-wrap-message",
("entityName", name),
("entity", ent),
("message", FormattedMessage.RemoveMarkup(action)));

foreach (var (session, data) in GetRecipients(source, WhisperClearRange))
{
if (session.AttachedEntity is not { Valid: true } listener)
continue;

if (MessageRangeCheck(session, data, range) == MessageRangeCheckResult.Disallowed)
continue;

_chatManager.ChatMessageToOne(ChatChannel.Emotes, action, wrappedMessage, source, false, session.Channel);
}

if (!hideLog)
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Subtle from {ToPrettyString(source):user} as {name}: {action}");
else
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Subtle from {ToPrettyString(source):user}: {action}");
}

// ReSharper disable once InconsistentNaming
private void SendLOOC(EntityUid source, ICommonSession player, string message, bool hideChat)
{
Expand Down Expand Up @@ -1012,6 +1056,7 @@ public enum InGameICChatType : byte
Speak,
Emote,
Whisper,
Subtle, // FloofStation
Telepathic //Nyano - Summary: adds telepathic as a type of message users can receive.
}

Expand Down
9 changes: 7 additions & 2 deletions Content.Shared/Chat/ChatChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Content.Shared.Chat
/// Represents chat channels that the player can filter chat tabs by.
/// </summary>
[Flags]
public enum ChatChannel : ushort
public enum ChatChannel : UInt32
{
None = 0,

Expand Down Expand Up @@ -90,10 +90,15 @@ public enum ChatChannel : ushort
/// </summary>
Telepathic = 1 << 15,

/// <summary>
/// Subtle - Floofstation
/// </summary>
Subtle = 1 << 16,

/// <summary>
/// Channels considered to be IC.
/// </summary>
IC = Local | Whisper | Radio | Dead | Emotes | Damage | Visual | Telepathic | Notifications, //Nyano - Summary: Adds telepathic as an 'IC' labelled chat..
IC = Local | Whisper | Radio | Dead | Emotes | Subtle | Damage | Visual | Telepathic | Notifications, //Nyano - Summary: Adds telepathic as an 'IC' labelled chat..

AdminRelated = Admin | AdminAlert | AdminChat,
}
Expand Down
9 changes: 7 additions & 2 deletions Content.Shared/Chat/ChatSelectChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/// Maps to <see cref="ChatChannel"/>, giving better names.
/// </remarks>
[Flags]
public enum ChatSelectChannel : ushort
public enum ChatSelectChannel : UInt32
{
None = 0,

Expand Down Expand Up @@ -41,6 +41,11 @@ public enum ChatSelectChannel : ushort
/// </summary>
Emotes = ChatChannel.Emotes,

/// <summary>
/// Subtle - Floofstation
/// </summary>
Subtle = ChatChannel.Subtle,

/// <summary>
/// Deadchat
/// </summary>
Expand All @@ -52,7 +57,7 @@ public enum ChatSelectChannel : ushort
Admin = ChatChannel.AdminChat,

/// <summary>
/// Nyano - Summary:. Telepathic channel for all psionic entities.
/// Nyano - Summary:. Telepathic channel for all psionic entities.
/// </summary>
Telepathic = ChatChannel.Telepathic,

Expand Down
3 changes: 2 additions & 1 deletion Content.Shared/Chat/SharedChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public abstract class SharedChatSystem : EntitySystem
public const char OOCPrefix = '[';
public const char EmotesPrefix = '@';
public const char EmotesAltPrefix = '*';
public const char SubtlePrefix = '-';
public const char AdminPrefix = ']';
public const char WhisperPrefix = ',';
public const char TelepathicPrefix = '='; //Nyano - Summary: Adds the telepathic channel's prefix.
public const char TelepathicPrefix = '='; //Nyano - Summary: Adds the telepathic channel's prefix.
public const char DefaultChannelKey = 'h';

[ValidatePrototypeId<RadioChannelPrototype>]
Expand Down
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/Floof/chat/ui/chat-box.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hud-chatbox-channel-Subtle = Subtle
hud-chatbox-select-channel-Subtle = Subtle
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ chat-manager-entity-me-wrap-message = [italic]{ PROPER($entity) ->
[true] {$entityName} {$message}[/italic]
}

chat-manager-entity-subtle-wrap-message = [italic]{ PROPER($entity) ->
*[false] the {$entityName} subtly {$message}[/italic]
[true] {$entityName} subtly {$message}[/italic]
}

chat-manager-entity-looc-wrap-message = LOOC: {$entityName}: {$message}
chat-manager-send-ooc-wrap-message = OOC: {$playerName}: {$message}
chat-manager-send-ooc-patron-wrap-message = OOC: [color={$patronColor}]{$playerName}[/color]: {$message}
Expand Down
Loading