Skip to content

Commit

Permalink
subtle ooc
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Feb 19, 2025
1 parent 44cf9d3 commit 4646ba5
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 13 deletions.
5 changes: 5 additions & 0 deletions Content.Client/Chat/Managers/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public void SendMessage(string text, ChatSelectChannel channel)
_consoleHost.ExecuteCommand($"subtle \"{CommandParsing.Escape(str)}\"");
break;

case ChatSelectChannel.SubtleOOC: // Den
_consoleHost.ExecuteCommand($"subtleooc \"{CommandParsing.Escape(str)}\"");
break;


case ChatSelectChannel.Dead:
if (_systems.GetEntitySystemOrNull<GhostSystem>() is {IsGhost: true})
goto case ChatSelectChannel.Local;
Expand Down
13 changes: 11 additions & 2 deletions Content.Client/UserInterface/Systems/Chat/ChatUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public sealed class ChatUIController : UIController
{SharedChatSystem.LOOCPrefix, ChatSelectChannel.LOOC},
{SharedChatSystem.OOCPrefix, ChatSelectChannel.OOC},
{SharedChatSystem.EmotesPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.EmotesAltPrefix, ChatSelectChannel.Emotes},
{SharedChatSystem.SubtlePrefix, ChatSelectChannel.Subtle}, // Floofstation
{SharedChatSystem.SubtleOOCPrefix, ChatSelectChannel.SubtleOOC},
{SharedChatSystem.AdminPrefix, ChatSelectChannel.Admin},
{SharedChatSystem.RadioCommonPrefix, ChatSelectChannel.Radio},
{SharedChatSystem.DeadPrefix, ChatSelectChannel.Dead},
Expand All @@ -101,6 +101,7 @@ public sealed class ChatUIController : UIController
{ChatSelectChannel.OOC, SharedChatSystem.OOCPrefix},
{ChatSelectChannel.Emotes, SharedChatSystem.EmotesPrefix},
{ChatSelectChannel.Subtle, SharedChatSystem.SubtlePrefix}, // Floofstation
{ChatSelectChannel.SubtleOOC, SharedChatSystem.SubtleOOCPrefix}, // Den
{ChatSelectChannel.Admin, SharedChatSystem.AdminPrefix},
{ChatSelectChannel.Radio, SharedChatSystem.RadioCommonPrefix},
{ChatSelectChannel.Dead, SharedChatSystem.DeadPrefix},
Expand Down Expand Up @@ -538,18 +539,20 @@ 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.
// TODO: this logic is iffy (checking if controlling something that's NOT a ghost), is there a better way to check this?
if (_ghost is not {IsGhost: true})
{
FilterableChannels |= ChatChannel.Subtle;
FilterableChannels |= ChatChannel.SubtleOOC;
CanSendChannels |= ChatSelectChannel.Local;
CanSendChannels |= ChatSelectChannel.Whisper;
CanSendChannels |= ChatSelectChannel.Radio;
CanSendChannels |= ChatSelectChannel.Emotes;
CanSendChannels |= ChatSelectChannel.Subtle; // Floofstation
CanSendChannels |= ChatSelectChannel.SubtleOOC;
}
}

Expand All @@ -560,6 +563,12 @@ private void UpdateChannelPermissions()
CanSendChannels |= ChatSelectChannel.Dead;
}

if (_admin.HasFlag(AdminFlags.Pii) && _ghost is { IsGhost: true })
{
FilterableChannels |= ChatChannel.Subtle;
FilterableChannels |= ChatChannel.SubtleOOC;
}

// only admins can see / filter asay
if (_admin.HasFlag(AdminFlags.Adminchat))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public sealed partial class ChannelFilterPopup : Popup
{
ChatChannel.Local,
ChatChannel.Whisper,
ChatChannel.Subtle,
ChatChannel.SubtleOOC,
ChatChannel.Emotes,
ChatChannel.Radio,
ChatChannel.Telepathic, //Nyano - Summary: adds telepathic chat to where it belongs in order in the chat.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class ChannelSelectorPopup : Popup
ChatSelectChannel.Whisper,
ChatSelectChannel.Emotes,
ChatSelectChannel.Subtle, // Floofstation
ChatSelectChannel.SubtleOOC,
ChatSelectChannel.Radio,
ChatSelectChannel.Telepathic, //Nyano - Summary: determines the order in which telepathic shows.
ChatSelectChannel.LOOC,
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Chat/Commands/SubtleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ internal sealed class SubtleCommand : IConsoleCommand
public string Description => "Perform an subtle action.";
public string Help => "subtle <text>";

private const string SubtleColor = "#d3d3ff";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
Expand All @@ -38,7 +40,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;

IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>()
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Subtle, ChatTransmitRange.NoGhosts, false, shell, player);
.TrySendInGameICMessage(playerEntity, message, InGameICChatType.Subtle, ChatTransmitRange.NoGhosts, false, shell, player, color: SubtleColor);
}
}
}
46 changes: 46 additions & 0 deletions Content.Server/Chat/Commands/SubtleOOCCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Robust.Shared.Console;
using Robust.Shared.Enums;

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

private const string SubtleOOCColor = "#ff7782";

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.SubtleOOC, ChatTransmitRange.NoGhosts, false, shell, player, color: SubtleOOCColor);
}
}
}
16 changes: 11 additions & 5 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public void TrySendInGameICMessage(
string? nameOverride = null,
bool checkRadioPrefix = true,
bool ignoreActionBlocker = false,
LanguagePrototype? languageOverride = null
LanguagePrototype? languageOverride = null,
string? color = null
)
{
if (HasComp<GhostComponent>(source))
Expand Down Expand Up @@ -233,7 +234,7 @@ public void TrySendInGameICMessage(

var language = languageOverride ?? _language.GetLanguage(source);

bool shouldCapitalize = (desiredType != InGameICChatType.Emote && desiredType != InGameICChatType.Subtle);
bool shouldCapitalize = (desiredType != InGameICChatType.Emote && desiredType != InGameICChatType.Subtle && desiredType != InGameICChatType.SubtleOOC);
bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation);
// Capitalizing the word I only happens in English, so we check language here
bool shouldCapitalizeTheWordI = (!CultureInfo.CurrentCulture.IsNeutralCulture && CultureInfo.CurrentCulture.Parent.Name == "en")
Expand Down Expand Up @@ -278,7 +279,10 @@ public void TrySendInGameICMessage(
SendEntityEmote(source, message, range, nameOverride, language, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
break;
case InGameICChatType.Subtle:
SendEntitySubtle(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker);
SendEntitySubtle(source, message, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker, color: color);
break;
case InGameICChatType.SubtleOOC:
SendEntitySubtle(source, $"ooc: {message}", range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker, color: color);
break;
//Nyano - Summary: case adds the telepathic chat sending ability.
case InGameICChatType.Telepathic:
Expand Down Expand Up @@ -615,7 +619,8 @@ private void SendEntitySubtle(
string? nameOverride,
bool hideLog = false,
bool ignoreActionBlocker = false,
NetUserId? author = null
NetUserId? author = null,
string? color = null
)
{
if (!_actionBlocker.CanEmote(source) && !ignoreActionBlocker)
Expand All @@ -629,7 +634,8 @@ private void SendEntitySubtle(
var wrappedMessage = Loc.GetString("chat-manager-entity-subtle-wrap-message",
("entityName", name),
("entity", ent),
("message", FormattedMessage.RemoveMarkup(action)));
("color", color ?? DefaultSpeakColor.ToHex()),
("message", FormattedMessage.RemoveMarkupPermissive(action)));

foreach (var (session, data) in GetRecipients(source, WhisperClearRange))
{
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/Chat/ChatChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public enum ChatChannel : UInt32
/// </summary>
Subtle = 1 << 16,

/// <summary>
/// Subtle - Floofstation
/// </summary>
SubtleOOC = 1 << 17,

/// <summary>
/// Channels considered to be IC.
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/Chat/ChatSelectChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public enum ChatSelectChannel : UInt32
/// </summary>
Subtle = ChatChannel.Subtle,

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

/// <summary>
/// Deadchat
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions Content.Shared/Chat/SharedChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public abstract class SharedChatSystem : EntitySystem
{
public const char RadioCommonPrefix = ';';
public const char RadioChannelPrefix = ':';
public const char RadioChannelAltPrefix = '.';
public const char LocalPrefix = '>';
public const char ConsolePrefix = '/';
public const char DeadPrefix = '\\';
Expand All @@ -22,6 +21,7 @@ public abstract class SharedChatSystem : EntitySystem
public const char EmotesPrefix = '@';
public const char EmotesAltPrefix = '*';
public const char SubtlePrefix = '-';
public const char SubtleOOCPrefix = '.';
public const char AdminPrefix = ']';
public const char WhisperPrefix = ',';
public const char TelepathicPrefix = '='; //Nyano - Summary: Adds the telepathic channel's prefix.
Expand Down Expand Up @@ -123,7 +123,7 @@ public bool TryProccessRadioMessage(
return true;
}

if (!(input.StartsWith(RadioChannelPrefix) || input.StartsWith(RadioChannelAltPrefix)))
if (!(input.StartsWith(RadioChannelPrefix)))
return false;

if (input.Length < 2 || char.IsWhiteSpace(input[1]))
Expand Down Expand Up @@ -281,6 +281,7 @@ public enum InGameICChatType : byte
Speak,
Emote,
Subtle, // Floofstation
SubtleOOC, // Den
Whisper,
Telepathic
}
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/Floof/chat/ui/chat-box.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
hud-chatbox-channel-Subtle = Subtle
hud-chatbox-select-channel-Subtle = Subtle
hud-chatbox-channel-SubtleOOC = Subtle OOC
hud-chatbox-select-channel-SubtleOOC = Subtle OOC
6 changes: 3 additions & 3 deletions Resources/Locale/en-US/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ 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-subtle-wrap-message = [italic][color={$color}]{ PROPER($entity) ->
*[false] the {$entityName} subtly {$message}[/color][/italic]
[true] {$entityName} subtly {$message}[/color][/italic]
}
chat-manager-entity-looc-wrap-message = LOOC: {$entityName}: {$message}
Expand Down

0 comments on commit 4646ba5

Please sign in to comment.