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
This commit is contained in:
SolStar 2024-11-06 16:50:09 -05:00 committed by GitHub
parent d7667f335f
commit e06d593302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

View File

@ -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<HushedComponent>(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

View File

@ -0,0 +1,6 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Speech.Hushing;
[RegisterComponent, NetworkedComponent]
public sealed partial class HushedComponent : Component;

View File

@ -21,5 +21,8 @@ trait-deuteranopia-name = Deuteranopia
trait-deuteranopia-desc = Whether through custom bionic eyes, random mutation,
or being a Vulpkanin, you have redgreen 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

View File

@ -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