From 009654bbb8c688b41dff4ad6952ac6c0b5f582d8 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Sun, 3 Nov 2024 17:07:16 -0500 Subject: [PATCH 1/8] Add new speech trait: Hushed --- Content.Shared/Speech/Muting/HushedComponent.cs | 10 ++++++++++ Resources/Locale/en-US/traits/traits.ftl | 3 +++ Resources/Prototypes/Traits/speech.yml | 12 ++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 Content.Shared/Speech/Muting/HushedComponent.cs diff --git a/Content.Shared/Speech/Muting/HushedComponent.cs b/Content.Shared/Speech/Muting/HushedComponent.cs new file mode 100644 index 00000000000..c6c4ebde822 --- /dev/null +++ b/Content.Shared/Speech/Muting/HushedComponent.cs @@ -0,0 +1,10 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Speech.Hushing +{ + [RegisterComponent, NetworkedComponent] + public sealed partial class HushedComponent : Component + { + + } +} diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index d9f09cc68aa..d0bc97b4d1b 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -18,6 +18,9 @@ trait-lightweight-desc = Alcohol has a stronger effect on you. trait-muted-name = Muted trait-muted-desc = You can't speak. +trait-hushed-name = Hushed +trait-hushed-desc = You are unable to speak louder than a whisper. + trait-paracusia-name = Paracusia trait-paracusia-desc = You hear sounds that aren't really there. diff --git a/Resources/Prototypes/Traits/speech.yml b/Resources/Prototypes/Traits/speech.yml index cc185b84f1a..aabfb885208 100644 --- a/Resources/Prototypes/Traits/speech.yml +++ b/Resources/Prototypes/Traits/speech.yml @@ -46,6 +46,18 @@ components: - type: FrontalLisp +- type: trait + id: Hushed + name: trait-hushed-name + description: trait-hushed-desc + category: SpeechTraits + cost: 0 + blacklist: + components: + - BorgChassis + components: + - type: Hushed + # 2 Cost - type: trait From a38d3fa8d6a4a56dc3b35035dc23e2242379a2c2 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Sun, 3 Nov 2024 18:16:28 -0500 Subject: [PATCH 2/8] Hushed entities' local messages will now be whispers --- Content.Server/Chat/Systems/ChatSystem.cs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 4c88e8cc5a4..938c594677d 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -8,9 +8,8 @@ using Content.Server.Players.RateLimiting; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; +using Content.Shared.Speech.Hushing; using Content.Server.Nyanotrasen.Chat; -using Content.Server.Speech.Components; -using Content.Server.Speech.EntitySystems; using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.ActionBlocker; @@ -214,11 +213,20 @@ public void TrySendInGameICMessage( _chatManager.EnsurePlayer(player.UserId).AddEntity(GetNetEntity(source)); } - if (desiredType == InGameICChatType.Speak && message.StartsWith(LocalPrefix)) + if (desiredType == InGameICChatType.Speak) { - // prevent radios and remove prefix. - checkRadioPrefix = false; - message = message[1..]; + if (message.StartsWith(LocalPrefix)) + { + // prevent radios and remove prefix. + checkRadioPrefix = false; + message = message[1..]; + } + + if (HasComp(source)) + { + // hushed players cannot speak on local chat so will be sent as whisper instead + desiredType = InGameICChatType.Whisper; + } } bool shouldCapitalize = (desiredType != InGameICChatType.Emote); From 108f23434ae2d6d9b1fe84f099477ccd686611f9 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Sun, 3 Nov 2024 23:11:41 -0500 Subject: [PATCH 3/8] Sepeate Hushed check from prefix removal --- Content.Server/Chat/Systems/ChatSystem.cs | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 938c594677d..a6c7bd927d2 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -8,8 +8,10 @@ using Content.Server.Players.RateLimiting; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; -using Content.Shared.Speech.Hushing; +using Content.Shared.Speech.Hushing; // Delta-V using Content.Server.Nyanotrasen.Chat; +//using Content.Server.Speech.Components; Duplicate - Delta-V +//using Content.Server.Speech.EntitySystems; Duplicate - Delta-V using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.ActionBlocker; @@ -213,21 +215,21 @@ public void TrySendInGameICMessage( _chatManager.EnsurePlayer(player.UserId).AddEntity(GetNetEntity(source)); } - if (desiredType == InGameICChatType.Speak) + if (desiredType == InGameICChatType.Speak && message.StartsWith(LocalPrefix)) { - if (message.StartsWith(LocalPrefix)) - { - // prevent radios and remove prefix. - checkRadioPrefix = false; - message = message[1..]; - } - - if (HasComp(source)) - { - // hushed players cannot speak on local chat so will be sent as whisper instead - desiredType = InGameICChatType.Whisper; - } + // prevent radios and remove prefix. + checkRadioPrefix = false; + message = message[1..]; + } + + // Delta-V + // 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; } + // End Delta-V bool shouldCapitalize = (desiredType != InGameICChatType.Emote); bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation); From 3bf7caa253247eab4fd4fcfc9b8d8d98ad7518f1 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Sun, 3 Nov 2024 23:35:14 -0500 Subject: [PATCH 4/8] Move to Delta-v Namespace --- .../Muting => DeltaV/Speech}/HushedComponent.cs | 0 Resources/Locale/en-US/deltav/traits/traits.ftl | 3 +++ Resources/Locale/en-US/traits/traits.ftl | 3 --- Resources/Prototypes/DeltaV/Traits/speech.yml | 11 +++++++++++ Resources/Prototypes/Traits/speech.yml | 12 ------------ 5 files changed, 14 insertions(+), 15 deletions(-) rename Content.Shared/{Speech/Muting => DeltaV/Speech}/HushedComponent.cs (100%) create mode 100644 Resources/Prototypes/DeltaV/Traits/speech.yml diff --git a/Content.Shared/Speech/Muting/HushedComponent.cs b/Content.Shared/DeltaV/Speech/HushedComponent.cs similarity index 100% rename from Content.Shared/Speech/Muting/HushedComponent.cs rename to Content.Shared/DeltaV/Speech/HushedComponent.cs diff --git a/Resources/Locale/en-US/deltav/traits/traits.ftl b/Resources/Locale/en-US/deltav/traits/traits.ftl index 489816a9c24..4c5444ec981 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/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index d0bc97b4d1b..d9f09cc68aa 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -18,9 +18,6 @@ trait-lightweight-desc = Alcohol has a stronger effect on you. trait-muted-name = Muted trait-muted-desc = You can't speak. -trait-hushed-name = Hushed -trait-hushed-desc = You are unable to speak louder than a whisper. - trait-paracusia-name = Paracusia trait-paracusia-desc = You hear sounds that aren't really there. diff --git a/Resources/Prototypes/DeltaV/Traits/speech.yml b/Resources/Prototypes/DeltaV/Traits/speech.yml new file mode 100644 index 00000000000..70207cb5e4b --- /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 diff --git a/Resources/Prototypes/Traits/speech.yml b/Resources/Prototypes/Traits/speech.yml index aabfb885208..cc185b84f1a 100644 --- a/Resources/Prototypes/Traits/speech.yml +++ b/Resources/Prototypes/Traits/speech.yml @@ -46,18 +46,6 @@ components: - type: FrontalLisp -- type: trait - id: Hushed - name: trait-hushed-name - description: trait-hushed-desc - category: SpeechTraits - cost: 0 - blacklist: - components: - - BorgChassis - components: - - type: Hushed - # 2 Cost - type: trait From 3ca27751067b09d58200bf5be2d8842c5cb543ef Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Sun, 3 Nov 2024 23:57:12 -0500 Subject: [PATCH 5/8] Minor refactoring --- Content.Server/Chat/Systems/ChatSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index a6c7bd927d2..0dac5b08aef 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -10,8 +10,8 @@ using Content.Server.Speech.EntitySystems; using Content.Shared.Speech.Hushing; // Delta-V using Content.Server.Nyanotrasen.Chat; -//using Content.Server.Speech.Components; Duplicate - Delta-V -//using Content.Server.Speech.EntitySystems; Duplicate - Delta-V +using Content.Server.Speech.Components; +using Content.Server.Speech.EntitySystems; using Content.Server.Station.Components; using Content.Server.Station.Systems; using Content.Shared.ActionBlocker; @@ -224,7 +224,7 @@ public void TrySendInGameICMessage( // Delta-V // This needs to happen after prefix removal to avoid bug - if (desiredType == InGameICChatType.Speak&&HasComp(source)) + if (desiredType == InGameICChatType.Speak && HasComp(source)) { // hushed players cannot speak on local chat so will be sent as whisper instead desiredType = InGameICChatType.Whisper; From 1b810208a1eff486a95f10bc11f74c15e0136c61 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Mon, 4 Nov 2024 12:30:43 -0500 Subject: [PATCH 6/8] Bug fixes --- Content.Shared/DeltaV/Speech/HushedComponent.cs | 5 +---- Resources/Prototypes/DeltaV/Traits/speech.yml | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Content.Shared/DeltaV/Speech/HushedComponent.cs b/Content.Shared/DeltaV/Speech/HushedComponent.cs index c6c4ebde822..9a4cf979608 100644 --- a/Content.Shared/DeltaV/Speech/HushedComponent.cs +++ b/Content.Shared/DeltaV/Speech/HushedComponent.cs @@ -3,8 +3,5 @@ namespace Content.Shared.Speech.Hushing { [RegisterComponent, NetworkedComponent] - public sealed partial class HushedComponent : Component - { - - } + public sealed partial class HushedComponent : Component; } diff --git a/Resources/Prototypes/DeltaV/Traits/speech.yml b/Resources/Prototypes/DeltaV/Traits/speech.yml index 70207cb5e4b..4876edd53eb 100644 --- a/Resources/Prototypes/DeltaV/Traits/speech.yml +++ b/Resources/Prototypes/DeltaV/Traits/speech.yml @@ -6,6 +6,6 @@ cost: 0 blacklist: components: - - BorgChassis + - BorgChassis components: - - type: Hushed + - type: Hushed From 75a67a34a9cb5845c68cfeef22c6116ed762cf62 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Mon, 4 Nov 2024 12:55:13 -0500 Subject: [PATCH 7/8] Change to file scoped namespace --- Content.Shared/DeltaV/Speech/HushedComponent.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Content.Shared/DeltaV/Speech/HushedComponent.cs b/Content.Shared/DeltaV/Speech/HushedComponent.cs index 9a4cf979608..db13e31438d 100644 --- a/Content.Shared/DeltaV/Speech/HushedComponent.cs +++ b/Content.Shared/DeltaV/Speech/HushedComponent.cs @@ -1,7 +1,6 @@ using Robust.Shared.GameStates; -namespace Content.Shared.Speech.Hushing -{ - [RegisterComponent, NetworkedComponent] - public sealed partial class HushedComponent : Component; -} +namespace Content.Shared.Speech.Hushing; + +[RegisterComponent, NetworkedComponent] +public sealed partial class HushedComponent : Component; From aa5b16dc36d024c0b8c922110312e9b651f527e9 Mon Sep 17 00:00:00 2001 From: SolStar2 Date: Mon, 4 Nov 2024 15:50:10 -0500 Subject: [PATCH 8/8] Change comments more in line to DeltaV --- Content.Server/Chat/Systems/ChatSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 0dac5b08aef..3b4eb5f8016 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -8,7 +8,7 @@ using Content.Server.Players.RateLimiting; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; -using Content.Shared.Speech.Hushing; // Delta-V +using Content.Shared.Speech.Hushing; // DeltaV using Content.Server.Nyanotrasen.Chat; using Content.Server.Speech.Components; using Content.Server.Speech.EntitySystems; @@ -222,14 +222,14 @@ public void TrySendInGameICMessage( message = message[1..]; } - // Delta-V + // 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; } - // End Delta-V + // DeltaV - End hushed trait logic bool shouldCapitalize = (desiredType != InGameICChatType.Emote); bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation);