From 3209838d90e377bea70d5a538d3f5d8ccd1ffd19 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Fri, 8 Nov 2024 11:14:08 -0500 Subject: [PATCH] Show Language Names In Chat (#1165) # Description Port of https://github.com/Lost-Paradise-Project/Lost-Paradise/pull/288 from Lost Paradise. This feature makes it so that the language you are speaking is shown in chat, preventing any confusion for players about what it is being spoken.

Media

![image](https://github.com/user-attachments/assets/25fa3e17-30bb-4ae7-8fbe-2114839c498d)

# Changelog :cl: - add: Languages are now shown in chat alongside character names. --------- Signed-off-by: VMSolidus Co-authored-by: Remuchi <72476615+Remuchi@users.noreply.github.com> --- Content.Server/Chat/Systems/ChatSystem.cs | 6 +++++- Content.Server/Radio/EntitySystems/RadioSystem.cs | 6 +++++- Content.Shared/Language/LanguagePrototype.cs | 13 ++++++++++++- .../Locale/en-US/chat/managers/chat-language.ftl | 15 +++++++++++++++ .../Locale/en-US/chat/managers/chat-manager.ftl | 8 ++++---- .../Locale/en-US/headset/headset-component.ftl | 4 ++-- .../Language/Species-Specific/diona.yml | 3 ++- .../Language/Species-Specific/harpy.yml | 1 + .../Language/Species-Specific/marish.yml | 3 ++- .../Prototypes/Language/Species-Specific/moth.yml | 3 ++- .../Language/Species-Specific/nekomimetic.yml | 3 ++- .../Language/Species-Specific/reptilian.yml | 1 + .../Language/Species-Specific/slimeperson.yml | 3 ++- .../Language/Species-Specific/vulpkanin.yml | 3 ++- Resources/Prototypes/Language/Standard/elyran.yml | 3 ++- .../Prototypes/Language/Standard/freespeak.yml | 1 + .../Prototypes/Language/Standard/solcommon.yml | 3 ++- .../Prototypes/Language/Standard/taucetibasic.yml | 2 +- .../Prototypes/Language/Standard/tradeband.yml | 1 + .../Prototypes/Language/genericlanguages.yml | 1 + 20 files changed, 65 insertions(+), 18 deletions(-) create mode 100644 Resources/Locale/en-US/chat/managers/chat-language.ftl diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 8afaafa3588..d743a83ef40 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -879,6 +879,9 @@ public string WrapMessage(LocId wrapId, InGameICChatType chatType, EntityUid sou var color = DefaultSpeakColor; if (language.SpeechOverride.Color is { } colorOverride) color = Color.InterpolateBetween(color, colorOverride, colorOverride.A); + var languageDisplay = language.IsVisibleLanguage + ? $"{language.ChatName} | " + : ""; return Loc.GetString(wrapId, ("color", color), @@ -886,7 +889,8 @@ public string WrapMessage(LocId wrapId, InGameICChatType chatType, EntityUid sou ("verb", Loc.GetString(verbId)), ("fontType", language.SpeechOverride.FontId ?? speech.FontId), ("fontSize", language.SpeechOverride.FontSize ?? speech.FontSize), - ("message", message)); + ("message", message), + ("language", languageDisplay)); } /// diff --git a/Content.Server/Radio/EntitySystems/RadioSystem.cs b/Content.Server/Radio/EntitySystems/RadioSystem.cs index 023b660ef89..71fb4ff5020 100644 --- a/Content.Server/Radio/EntitySystems/RadioSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioSystem.cs @@ -166,6 +166,9 @@ private string WrapRadioMessage(EntityUid source, RadioChannelPrototype channel, var languageColor = channel.Color; if (language.SpeechOverride.Color is { } colorOverride) languageColor = Color.InterpolateBetween(languageColor, colorOverride, colorOverride.A); + var languageDisplay = language.IsVisibleLanguage + ? $"{language.ChatName} | " + : ""; return Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap", ("color", channel.Color), @@ -175,7 +178,8 @@ private string WrapRadioMessage(EntityUid source, RadioChannelPrototype channel, ("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))), ("channel", $"\\[{channel.LocalizedName}\\]"), ("name", name), - ("message", message)); + ("message", message), + ("language", languageDisplay)); } /// diff --git a/Content.Shared/Language/LanguagePrototype.cs b/Content.Shared/Language/LanguagePrototype.cs index 3b2b24c4b25..dbc53c65d47 100644 --- a/Content.Shared/Language/LanguagePrototype.cs +++ b/Content.Shared/Language/LanguagePrototype.cs @@ -7,7 +7,13 @@ namespace Content.Shared.Language; public sealed partial class LanguagePrototype : IPrototype { [IdDataField] - public string ID { get; private set; } = default!; + public string ID { get; private set; } = default!; + + /// + /// Whether this language will display its name in chat behind a player's name. + /// + [DataField] + public bool IsVisibleLanguage { get; set; } /// /// Obfuscation method used by this language. By default, uses @@ -27,6 +33,11 @@ public sealed partial class LanguagePrototype : IPrototype /// public string Name => Loc.GetString($"language-{ID}-name"); + /// + /// The in-world chat abbreviation of this language, localized. + /// + public string ChatName => Loc.GetString($"chat-language-{ID}-name"); + /// /// The in-world description of this language, localized. /// diff --git a/Resources/Locale/en-US/chat/managers/chat-language.ftl b/Resources/Locale/en-US/chat/managers/chat-language.ftl new file mode 100644 index 00000000000..f9751606745 --- /dev/null +++ b/Resources/Locale/en-US/chat/managers/chat-language.ftl @@ -0,0 +1,15 @@ +chat-language-Universal-name = Universal +chat-language-Bubblish-name = Bubblish +chat-language-RootSpeak-name = Rootspeak +chat-language-Nekomimetic-name = Neko +chat-language-Draconic-name = Sinta'Unathi +chat-language-Azaziba-name = Sinta'Azaziba +chat-language-SolCommon-name = Sol Common +chat-language-TauCetiBasic-name = Basic +chat-language-Tradeband-name = Tradeband +chat-language-Freespeak-name = Freespeak +chat-language-Elyran-name = Elyran +chat-language-Canilunzt-name = Canilunzt +chat-language-Moffic-name = Moffic +chat-language-RobotTalk-name = Binary +chat-language-ValyrianStandard-name = Valyrian diff --git a/Resources/Locale/en-US/chat/managers/chat-manager.ftl b/Resources/Locale/en-US/chat/managers/chat-manager.ftl index e25522ac1df..f2b70e72a83 100644 --- a/Resources/Locale/en-US/chat/managers/chat-manager.ftl +++ b/Resources/Locale/en-US/chat/managers/chat-manager.ftl @@ -21,10 +21,10 @@ chat-manager-whisper-headset-on-message = You can't whisper on the radio! chat-manager-server-wrap-message = [bold]{$message}[/bold] chat-manager-sender-announcement-wrap-message = [font size=14][bold]{$sender} Announcement:[/font][font size=12] {$message}[/bold][/font] -chat-manager-entity-say-wrap-message = [BubbleHeader][Name]{$entityName}[/Name][/BubbleHeader] {$verb}, "[BubbleContent][font="{$fontType}" size={$fontSize}][color={$color}]{$message}[/color][/font][/BubbleContent]" -chat-manager-entity-say-bold-wrap-message = [BubbleHeader][Name]{$entityName}[/Name][/BubbleHeader] {$verb}, "[BubbleContent][font="{$fontType}" size={$fontSize}][color={$color}][bold]{$message}[/bold][/color][/font][/BubbleContent]" +chat-manager-entity-say-wrap-message = [BubbleHeader][bold][Name]{ $language }{ $entityName }[/Name][/bold][/BubbleHeader] { $verb }, [font={ $fontType } size={ $fontSize } ]"[BubbleContent]{ $message }[/BubbleContent]"[/font] +chat-manager-entity-say-bold-wrap-message = [BubbleHeader][bold][Name]{ $language }{ $entityName }[/Name][/bold][/BubbleHeader] { $verb }, [font={ $fontType } size={ $fontSize }]"[BubbleContent][bold]{ $message }[/bold][/BubbleContent]"[/font] -chat-manager-entity-whisper-wrap-message = [font size=11][italic][BubbleHeader][Name]{$entityName}[/Name][/BubbleHeader] whispers, "[BubbleContent][font="{$fontType}"][color={$color}]{$message}[/color][/font][/BubbleContent]"[/italic][/font] +chat-manager-entity-whisper-wrap-message = [font size=11][italic][BubbleHeader][Name]{ $language }{ $entityName }[/Name][/BubbleHeader] whispers,"[BubbleContent]{ $message }[/BubbleContent]"[/italic][/font] chat-manager-entity-whisper-unknown-wrap-message = [font size=11][italic][BubbleHeader]Someone[/BubbleHeader] whispers, "[BubbleContent][font="{$fontType}"][color={$color}]{$message}[/color][/font][/BubbleContent]"[/italic][/font] # THE() is not used here because the entity and its name can technically be disconnected if a nameOverride is passed... @@ -159,4 +159,4 @@ chat-speech-verb-electricity-1 = crackles chat-speech-verb-electricity-2 = buzzes chat-speech-verb-electricity-3 = screeches -chat-speech-verb-marish = Mars \ No newline at end of file +chat-speech-verb-marish = Mars diff --git a/Resources/Locale/en-US/headset/headset-component.ftl b/Resources/Locale/en-US/headset/headset-component.ftl index 75c83643d6d..3f89dde13ab 100644 --- a/Resources/Locale/en-US/headset/headset-component.ftl +++ b/Resources/Locale/en-US/headset/headset-component.ftl @@ -1,6 +1,6 @@ # Chat window radio wrap (prefix and postfix) -chat-radio-message-wrap = [color={$color}]{$channel} {$name} {$verb}, [font="{$fontType}" size={$fontSize}]"[/color][color={$languageColor}]{$message}[/color][color={$color}]"[/font][/color] -chat-radio-message-wrap-bold = [color={$color}]{$channel} {$name} {$verb}, [font="{$fontType}" size={$fontSize}][bold]"[/color][color={$languageColor}]{$message}[/color][color={$color}]"[/bold][/font][/color] +chat-radio-message-wrap = [color={ $color }]{ $channel } [bold]{ $language }{ $name }[/bold] { $verb }, [font={ $fontType } size={ $fontSize }]"{ $message }"[/font][/color] +chat-radio-message-wrap-bold = [color={ $color }]{ $channel } [bold]{ $language }{ $name }[/bold] { $verb }, [font={ $fontType } size={ $fontSize }][bold]"{ $message }"[/bold][/font][/color] examine-headset-default-channel = Use {$prefix} for the default channel ([color={$color}]{$channel}[/color]). diff --git a/Resources/Prototypes/Language/Species-Specific/diona.yml b/Resources/Prototypes/Language/Species-Specific/diona.yml index 76b62163ff3..57c928dc465 100644 --- a/Resources/Prototypes/Language/Species-Specific/diona.yml +++ b/Resources/Prototypes/Language/Species-Specific/diona.yml @@ -2,6 +2,7 @@ # TODO: Replace this with a much better language. - type: language id: RootSpeak + isVisibleLanguage: true speech: color: "#ce5e14dd" fontId: Noganas @@ -14,4 +15,4 @@ - zt - kr - st - - sh \ No newline at end of file + - sh diff --git a/Resources/Prototypes/Language/Species-Specific/harpy.yml b/Resources/Prototypes/Language/Species-Specific/harpy.yml index 143b089bd14..531b92e3259 100644 --- a/Resources/Prototypes/Language/Species-Specific/harpy.yml +++ b/Resources/Prototypes/Language/Species-Specific/harpy.yml @@ -1,5 +1,6 @@ - type: language id: ValyrianStandard + isVisibleLanguage: true speech: fontId: Cambria color: "#008ecc" diff --git a/Resources/Prototypes/Language/Species-Specific/marish.yml b/Resources/Prototypes/Language/Species-Specific/marish.yml index 872d67373d2..20b42a80d16 100644 --- a/Resources/Prototypes/Language/Species-Specific/marish.yml +++ b/Resources/Prototypes/Language/Species-Specific/marish.yml @@ -1,6 +1,7 @@ # Spoken by shadowkins. - type: language id: Marish + isVisibleLanguage: true speech: color: "#be3cc5" fontId: Lymphatic @@ -17,4 +18,4 @@ - maaAr - aarrr - wrurrl - - mmar \ No newline at end of file + - mmar diff --git a/Resources/Prototypes/Language/Species-Specific/moth.yml b/Resources/Prototypes/Language/Species-Specific/moth.yml index ed0a6009c59..e44b3bdd7ce 100644 --- a/Resources/Prototypes/Language/Species-Specific/moth.yml +++ b/Resources/Prototypes/Language/Species-Specific/moth.yml @@ -2,6 +2,7 @@ # TODO: Replace this with a much better language. - type: language id: Moffic + isVisibleLanguage: true speech: color: "#c7df2edd" fontId: Copperplate @@ -66,4 +67,4 @@ - uhr - kön - we - - hön \ No newline at end of file + - hön diff --git a/Resources/Prototypes/Language/Species-Specific/nekomimetic.yml b/Resources/Prototypes/Language/Species-Specific/nekomimetic.yml index 3610e5fa50e..a9dae1650df 100644 --- a/Resources/Prototypes/Language/Species-Specific/nekomimetic.yml +++ b/Resources/Prototypes/Language/Species-Specific/nekomimetic.yml @@ -2,6 +2,7 @@ # TODO: Replace this with a much better language. - type: language id: Nekomimetic + isVisibleLanguage: true speech: color: "#df57aaee" fontId: Manga @@ -57,4 +58,4 @@ - puru - ira - heto - - etto \ No newline at end of file + - etto diff --git a/Resources/Prototypes/Language/Species-Specific/reptilian.yml b/Resources/Prototypes/Language/Species-Specific/reptilian.yml index 6f9a10efa61..b5ba3f6dda1 100644 --- a/Resources/Prototypes/Language/Species-Specific/reptilian.yml +++ b/Resources/Prototypes/Language/Species-Specific/reptilian.yml @@ -1,6 +1,7 @@ # Spoken by Unathi. - type: language id: Draconic + isVisibleLanguage: true speech: color: "#2aca2add" obfuscation: diff --git a/Resources/Prototypes/Language/Species-Specific/slimeperson.yml b/Resources/Prototypes/Language/Species-Specific/slimeperson.yml index a3c1f91a170..a4d8fc13451 100644 --- a/Resources/Prototypes/Language/Species-Specific/slimeperson.yml +++ b/Resources/Prototypes/Language/Species-Specific/slimeperson.yml @@ -2,6 +2,7 @@ # TODO: Replace this with a much better language. - type: language id: Bubblish + isVisibleLanguage: true speech: color: "#00a3e2dd" fontId: RubikBubbles @@ -14,4 +15,4 @@ - plop - pop - bop - - boop \ No newline at end of file + - boop diff --git a/Resources/Prototypes/Language/Species-Specific/vulpkanin.yml b/Resources/Prototypes/Language/Species-Specific/vulpkanin.yml index 17a48493a49..2b53f79a55e 100644 --- a/Resources/Prototypes/Language/Species-Specific/vulpkanin.yml +++ b/Resources/Prototypes/Language/Species-Specific/vulpkanin.yml @@ -2,6 +2,7 @@ # TODO: Replace this with a much better language. - type: language id: Canilunzt + isVisibleLanguage: true speech: color: "#d69b3dcc" obfuscation: @@ -65,4 +66,4 @@ - einech - cresthz - azunein - - ghzth \ No newline at end of file + - ghzth diff --git a/Resources/Prototypes/Language/Standard/elyran.yml b/Resources/Prototypes/Language/Standard/elyran.yml index c2c90e7b6f0..b97a0698f29 100644 --- a/Resources/Prototypes/Language/Standard/elyran.yml +++ b/Resources/Prototypes/Language/Standard/elyran.yml @@ -1,5 +1,6 @@ - type: language id: Elyran + isVisibleLanguage: true speech: color: "#8282fbaa" obfuscation: @@ -83,4 +84,4 @@ - an' - e' - a' - - em' \ No newline at end of file + - em' diff --git a/Resources/Prototypes/Language/Standard/freespeak.yml b/Resources/Prototypes/Language/Standard/freespeak.yml index 831c2a67ff8..9fe252e5b20 100644 --- a/Resources/Prototypes/Language/Standard/freespeak.yml +++ b/Resources/Prototypes/Language/Standard/freespeak.yml @@ -1,5 +1,6 @@ - type: language id: Freespeak + isVisibleLanguage: true speech: color: "#597d35" obfuscation: diff --git a/Resources/Prototypes/Language/Standard/solcommon.yml b/Resources/Prototypes/Language/Standard/solcommon.yml index 88c5470154b..4bd1563f74c 100644 --- a/Resources/Prototypes/Language/Standard/solcommon.yml +++ b/Resources/Prototypes/Language/Standard/solcommon.yml @@ -1,5 +1,6 @@ - type: language id: SolCommon + isVisibleLanguage: true speech: color: "#8282fbaa" obfuscation: @@ -255,4 +256,4 @@ - zo - zu - zun - - zuo \ No newline at end of file + - zuo diff --git a/Resources/Prototypes/Language/Standard/taucetibasic.yml b/Resources/Prototypes/Language/Standard/taucetibasic.yml index 96426f6c24f..f21834f04e6 100644 --- a/Resources/Prototypes/Language/Standard/taucetibasic.yml +++ b/Resources/Prototypes/Language/Standard/taucetibasic.yml @@ -253,4 +253,4 @@ - zem - zo - zoj - - zon \ No newline at end of file + - zon diff --git a/Resources/Prototypes/Language/Standard/tradeband.yml b/Resources/Prototypes/Language/Standard/tradeband.yml index 96415dc5a6e..53613b46b25 100644 --- a/Resources/Prototypes/Language/Standard/tradeband.yml +++ b/Resources/Prototypes/Language/Standard/tradeband.yml @@ -1,5 +1,6 @@ - type: language id: Tradeband + isVisibleLanguage: true speech: color: "#597d35" obfuscation: diff --git a/Resources/Prototypes/Language/genericlanguages.yml b/Resources/Prototypes/Language/genericlanguages.yml index 8d172cdae9c..90cb874ee68 100644 --- a/Resources/Prototypes/Language/genericlanguages.yml +++ b/Resources/Prototypes/Language/genericlanguages.yml @@ -12,6 +12,7 @@ # TODO: Replace this with much better languages. Yes, robots can have languages. - type: language id: RobotTalk + isVisibleLanguage: true speech: fontId: Monospace obfuscation: