Skip to content

Commit e06d593

Browse files
authored
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
1 parent d7667f3 commit e06d593

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

Content.Server/Chat/Systems/ChatSystem.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Content.Server.Players.RateLimiting;
99
using Content.Server.Speech.Components;
1010
using Content.Server.Speech.EntitySystems;
11+
using Content.Shared.Speech.Hushing; // DeltaV
1112
using Content.Server.Nyanotrasen.Chat;
1213
using Content.Server.Speech.Components;
1314
using Content.Server.Speech.EntitySystems;
@@ -221,6 +222,15 @@ public void TrySendInGameICMessage(
221222
message = message[1..];
222223
}
223224

225+
// DeltaV - Hushed trait logic
226+
// This needs to happen after prefix removal to avoid bug
227+
if (desiredType == InGameICChatType.Speak && HasComp<HushedComponent>(source))
228+
{
229+
// hushed players cannot speak on local chat so will be sent as whisper instead
230+
desiredType = InGameICChatType.Whisper;
231+
}
232+
// DeltaV - End hushed trait logic
233+
224234
bool shouldCapitalize = (desiredType != InGameICChatType.Emote);
225235
bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation);
226236
// Capitalizing the word I only happens in English, so we check language here
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
using Robust.Shared.GameStates;
2+
3+
namespace Content.Shared.Speech.Hushing;
4+
5+
[RegisterComponent, NetworkedComponent]
6+
public sealed partial class HushedComponent : Component;

Resources/Locale/en-US/deltav/traits/traits.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ trait-deuteranopia-name = Deuteranopia
2121
trait-deuteranopia-desc = Whether through custom bionic eyes, random mutation,
2222
or being a Vulpkanin, you have red–green colour blindness.
2323
24+
trait-hushed-name = Hushed
25+
trait-hushed-desc = You are unable to speak louder than a whisper.
26+
2427
trait-uncloneable-name = Uncloneable
2528
trait-uncloneable-desc = Cannot be cloned
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- type: trait
2+
id: Hushed
3+
name: trait-hushed-name
4+
description: trait-hushed-desc
5+
category: SpeechTraits
6+
cost: 0
7+
blacklist:
8+
components:
9+
- BorgChassis
10+
components:
11+
- type: Hushed

0 commit comments

Comments
 (0)