From e06d5933025eb5bf6486b5c9689eb03c3df2fd67 Mon Sep 17 00:00:00 2001 From: SolStar <44028047+ewokswagger@users.noreply.github.com> Date: Wed, 6 Nov 2024 16:50:09 -0500 Subject: [PATCH] Add hushed trait (#2106) * Add new speech trait: Hushed * Hushed entities' local messages will now be whispers * Sepeate Hushed check from prefix removal * Move to Delta-v Namespace * Minor refactoring * Bug fixes * Change to file scoped namespace * Change comments more in line to DeltaV --- Content.Server/Chat/Systems/ChatSystem.cs | 10 ++++++++++ Content.Shared/DeltaV/Speech/HushedComponent.cs | 6 ++++++ Resources/Locale/en-US/deltav/traits/traits.ftl | 3 +++ Resources/Prototypes/DeltaV/Traits/speech.yml | 11 +++++++++++ 4 files changed, 30 insertions(+) create mode 100644 Content.Shared/DeltaV/Speech/HushedComponent.cs create mode 100644 Resources/Prototypes/DeltaV/Traits/speech.yml diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 4c88e8cc5a..3b4eb5f801 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -8,6 +8,7 @@ using Content.Server.GameTicking; using Content.Server.Players.RateLimiting; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; +using Content.Shared.Speech.Hushing; // DeltaV using Content.Server.Nyanotrasen.Chat; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; @@ -221,6 +222,15 @@ public sealed partial class ChatSystem : SharedChatSystem message = message[1..]; } + // DeltaV - Hushed trait logic + // This needs to happen after prefix removal to avoid bug + if (desiredType == InGameICChatType.Speak && HasComp(source)) + { + // hushed players cannot speak on local chat so will be sent as whisper instead + desiredType = InGameICChatType.Whisper; + } + // DeltaV - End hushed trait logic + bool shouldCapitalize = (desiredType != InGameICChatType.Emote); bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation); // Capitalizing the word I only happens in English, so we check language here diff --git a/Content.Shared/DeltaV/Speech/HushedComponent.cs b/Content.Shared/DeltaV/Speech/HushedComponent.cs new file mode 100644 index 0000000000..db13e31438 --- /dev/null +++ b/Content.Shared/DeltaV/Speech/HushedComponent.cs @@ -0,0 +1,6 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Speech.Hushing; + +[RegisterComponent, NetworkedComponent] +public sealed partial class HushedComponent : Component; diff --git a/Resources/Locale/en-US/deltav/traits/traits.ftl b/Resources/Locale/en-US/deltav/traits/traits.ftl index 489816a9c2..4c5444ec98 100644 --- a/Resources/Locale/en-US/deltav/traits/traits.ftl +++ b/Resources/Locale/en-US/deltav/traits/traits.ftl @@ -21,5 +21,8 @@ trait-deuteranopia-name = Deuteranopia trait-deuteranopia-desc = Whether through custom bionic eyes, random mutation, or being a Vulpkanin, you have red–green colour blindness. +trait-hushed-name = Hushed +trait-hushed-desc = You are unable to speak louder than a whisper. + trait-uncloneable-name = Uncloneable trait-uncloneable-desc = Cannot be cloned diff --git a/Resources/Prototypes/DeltaV/Traits/speech.yml b/Resources/Prototypes/DeltaV/Traits/speech.yml new file mode 100644 index 0000000000..4876edd53e --- /dev/null +++ b/Resources/Prototypes/DeltaV/Traits/speech.yml @@ -0,0 +1,11 @@ +- type: trait + id: Hushed + name: trait-hushed-name + description: trait-hushed-desc + category: SpeechTraits + cost: 0 + blacklist: + components: + - BorgChassis + components: + - type: Hushed