From ac2f511baf342616a382fd4ead996284399a7528 Mon Sep 17 00:00:00 2001 From: FaDeOkno Date: Fri, 2 Aug 2024 17:30:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=B0=D0=BA=20=D0=B3=D0=BE=D0=B2=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D1=82=D1=81=D1=8F,=20Fix=20shit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Client/ADT/Language/LanguageSystem.cs | 4 +- .../ADT/Language/TranslatorImplantSystem.cs | 2 +- .../Language/UI/LanguageMenuWindow.xaml.cs | 4 +- Content.Client/Corvax/TTS/TTSSystem.cs | 4 +- Content.Client/Input/ContentContexts.cs | 2 +- .../Options/UI/Tabs/KeyRebindTab.xaml.cs | 2 +- .../Languages/LanguageMenuUIController.cs | 4 +- .../MenuBar/GameTopMenuBarUIController.cs | 8 +-- .../MenuBar/Widgets/GameTopMenuBar.xaml | 2 + Content.Server/ADT/Language/LanguageSystem.cs | 4 +- .../ADT/Language/TranslatorSystem.cs | 4 +- Content.Server/Chat/Systems/ChatSystem.cs | 70 +++++++++---------- Content.Server/Corvax/TTS/TTSSystem.cs | 25 ++++--- .../EntityEffects/Effects/MakeSentient.cs | 2 +- .../Mind/Commands/MakeSentientCommand.cs | 2 +- .../Radio/EntitySystems/HeadsetSystem.cs | 6 +- .../Radio/EntitySystems/RadioDeviceSystem.cs | 6 +- .../Radio/EntitySystems/RadioSystem.cs | 18 +++-- Content.Server/Radio/RadioEvent.cs | 4 +- .../Components/HandheldTranslatorComponent.cs | 2 +- .../Components/LanguageSpeakerComponent.cs | 2 +- .../ADT/Language/LanguagePrototype.cs | 2 +- .../Language/Systems/SharedLanguageSystem.cs | 2 +- .../Systems/SharedTranslatorImplantSystem.cs | 2 +- .../Systems/SharedTranslatorSystem.cs | 2 +- Content.Shared/Corvax/TTS/PlayTTSEvent.cs | 10 +-- .../Device/{Translators => }/handheld.yml | 1 + .../Translators => Misc}/implanters.yml | 1 + .../subdermal_implants.yml} | 1 + .../Entities/Structures/Machines/lathe.yml | 3 + 30 files changed, 111 insertions(+), 90 deletions(-) rename Resources/Prototypes/ADT/Entities/Objects/Device/{Translators => }/handheld.yml (99%) rename Resources/Prototypes/ADT/Entities/Objects/{Device/Translators => Misc}/implanters.yml (99%) rename Resources/Prototypes/ADT/Entities/Objects/{Device/Translators/implants.yml => Misc/subdermal_implants.yml} (99%) diff --git a/Content.Client/ADT/Language/LanguageSystem.cs b/Content.Client/ADT/Language/LanguageSystem.cs index 8312272ffc1..a56216ecfbb 100644 --- a/Content.Client/ADT/Language/LanguageSystem.cs +++ b/Content.Client/ADT/Language/LanguageSystem.cs @@ -1,4 +1,6 @@ -namespace Content.Shared.Language; +using Content.Shared.ADT.Language; + +namespace Content.Client.ADT.Language; public sealed partial class LanguageSystem : SharedLanguageSystem { diff --git a/Content.Client/ADT/Language/TranslatorImplantSystem.cs b/Content.Client/ADT/Language/TranslatorImplantSystem.cs index d34d770997e..83067d0669e 100644 --- a/Content.Client/ADT/Language/TranslatorImplantSystem.cs +++ b/Content.Client/ADT/Language/TranslatorImplantSystem.cs @@ -1,6 +1,6 @@ using Content.Shared.Implants; -namespace Content.Client.Implants; +namespace Content.Client.ADT.Implants; public sealed class TranslatorImplantSystem : SharedTranslatorImplantSystem { diff --git a/Content.Client/ADT/Language/UI/LanguageMenuWindow.xaml.cs b/Content.Client/ADT/Language/UI/LanguageMenuWindow.xaml.cs index 8492e15de40..e21bd9ca2e3 100644 --- a/Content.Client/ADT/Language/UI/LanguageMenuWindow.xaml.cs +++ b/Content.Client/ADT/Language/UI/LanguageMenuWindow.xaml.cs @@ -1,4 +1,4 @@ -using Content.Shared.Language; +using Content.Shared.ADT.Language; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; @@ -12,9 +12,7 @@ namespace Content.Client.ADT.Language.UI; [GenerateTypedNameReferences] public sealed partial class LanguageMenuWindow : DefaultWindow { - [Dependency] private readonly IConsoleHost _consoleHost = default!; [Dependency] private readonly EntityManager _entManager = default!; - [Dependency] private readonly IEntityManager _iEntManager = default!; [Dependency] private readonly ISharedPlayerManager _playerManager = default!; diff --git a/Content.Client/Corvax/TTS/TTSSystem.cs b/Content.Client/Corvax/TTS/TTSSystem.cs index dc65f907b22..256e2cc5f76 100644 --- a/Content.Client/Corvax/TTS/TTSSystem.cs +++ b/Content.Client/Corvax/TTS/TTSSystem.cs @@ -8,7 +8,7 @@ using Robust.Shared.Configuration; using Robust.Shared.ContentPack; using Robust.Shared.Utility; -using Content.Shared.Language; +using Content.Shared.ADT.Language; using Robust.Shared.Player; namespace Content.Client.Corvax.TTS; @@ -73,6 +73,7 @@ private void OnPlayTTS(PlayTTSEvent ev) var filePath = new ResPath($"{_fileIdx++}.ogg"); + // Languages TTS support start var player = _playerManager.LocalSession?.AttachedEntity; if (player != null) { @@ -83,6 +84,7 @@ private void OnPlayTTS(PlayTTSEvent ev) } else _contentRoot.AddOrUpdateFile(filePath, ev.Data); + // Languages TTS support end var audioResource = new AudioResource(); audioResource.Load(IoCManager.Instance!, Prefix / filePath); diff --git a/Content.Client/Input/ContentContexts.cs b/Content.Client/Input/ContentContexts.cs index d0dbace0b15..191bf7a2541 100644 --- a/Content.Client/Input/ContentContexts.cs +++ b/Content.Client/Input/ContentContexts.cs @@ -61,7 +61,7 @@ public static void SetupContexts(IInputContextContainer contexts) human.AddFunction(ContentKeyFunctions.AltUseItemInHand); human.AddFunction(ContentKeyFunctions.OpenCharacterMenu); human.AddFunction(ContentKeyFunctions.OpenEmotesMenu); - human.AddFunction(ContentKeyFunctions.OpenLanguagesMenu); + human.AddFunction(ContentKeyFunctions.OpenLanguagesMenu); // ADT Languages human.AddFunction(ContentKeyFunctions.ActivateItemInWorld); human.AddFunction(ContentKeyFunctions.ThrowItemInHand); human.AddFunction(ContentKeyFunctions.AltActivateItemInWorld); diff --git a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs index af22be091a0..6f51b954917 100644 --- a/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs +++ b/Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs @@ -216,7 +216,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action, IOnStateExited { diff --git a/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs b/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs index 0b29310f71d..1c3b03483b9 100644 --- a/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs +++ b/Content.Client/UserInterface/Systems/MenuBar/GameTopMenuBarUIController.cs @@ -9,7 +9,7 @@ using Content.Client.UserInterface.Systems.Guidebook; using Content.Client.UserInterface.Systems.MenuBar.Widgets; using Content.Client.UserInterface.Systems.Sandbox; -using Content.Client.UserInterface.Systems.Language; // Lang affected +using Content.Client.UserInterface.Systems.Language; // ADT Languages using Robust.Client.UserInterface.Controllers; namespace Content.Client.UserInterface.Systems.MenuBar; @@ -25,7 +25,7 @@ public sealed class GameTopMenuBarUIController : UIController [Dependency] private readonly SandboxUIController _sandbox = default!; [Dependency] private readonly GuidebookUIController _guidebook = default!; [Dependency] private readonly EmotesUIController _emotes = default!; - [Dependency] private readonly LanguageMenuUIController _language = default!; // Lang affected + [Dependency] private readonly LanguageMenuUIController _language = default!; // ADT Languages private GameTopMenuBar? GameTopMenuBar => UIManager.GetActiveUIWidgetOrNull(); @@ -49,7 +49,7 @@ public void UnloadButtons() _action.UnloadButton(); _sandbox.UnloadButton(); _emotes.UnloadButton(); - _language.UnloadButton(); // Lang affected + _language.UnloadButton(); // ADT Languages } public void LoadButtons() @@ -63,6 +63,6 @@ public void LoadButtons() _action.LoadButton(); _sandbox.LoadButton(); _emotes.LoadButton(); - _language.LoadButton(); // Lang affected + _language.LoadButton(); // ADT Languages } } diff --git a/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml b/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml index 751a223bdf3..59640586174 100644 --- a/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml +++ b/Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml @@ -53,6 +53,7 @@ HorizontalExpand="True" AppendStyleClass="{x:Static style:StyleBase.ButtonSquare}" /> + + @@ -180,7 +180,7 @@ public void TrySendInGameICMessage( string? nameOverride = null, bool checkRadioPrefix = true, bool ignoreActionBlocker = false, - LanguagePrototype? language = null // Lang affected + LanguagePrototype? language = null // ADT Languages ) { if (HasComp(source)) @@ -224,7 +224,7 @@ public void TrySendInGameICMessage( message = message[1..]; } - // Lang start + // ADT Languages start bool shouldCapitalize = (desiredType != InGameICChatType.Emote); bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation); @@ -234,7 +234,7 @@ public void TrySendInGameICMessage( string sanitizedMessage = SanitizeInGameICMessage(source, message, out var emoteStr, shouldCapitalize, shouldPunctuate, shouldCapitalizeTheWordI); - // Lang end + // ADT Languages end // Was there an emote in the message? If so, send it. if (player != null && emoteStr != message && emoteStr != null) @@ -260,13 +260,13 @@ public void TrySendInGameICMessage( switch (desiredType) { case InGameICChatType.Speak: - SendEntitySpeak(source, message, range, nameOverride, hideLog, ignoreActionBlocker, language); // Lang affected + SendEntitySpeak(source, message, range, nameOverride, hideLog, ignoreActionBlocker, language); // ADT Languages break; case InGameICChatType.Whisper: - SendEntityWhisper(source, message, range, null, nameOverride, hideLog, ignoreActionBlocker, language); // Lang affected + SendEntityWhisper(source, message, range, null, nameOverride, hideLog, ignoreActionBlocker, language); // ADT Languages break; case InGameICChatType.Emote: - SendEntityEmote(source, sanitizedMessage, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker); // Accent fix + SendEntityEmote(source, sanitizedMessage, range, nameOverride, hideLog: hideLog, ignoreActionBlocker: ignoreActionBlocker); // ADT Languages break; } } @@ -394,7 +394,7 @@ private void SendEntitySpeak( string? nameOverride, bool hideLog = false, bool ignoreActionBlocker = false, - LanguagePrototype? language = null // Lang affected + LanguagePrototype? language = null // ADT Languages ) { if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker) @@ -405,10 +405,10 @@ private void SendEntitySpeak( if (message.Length == 0) return; - // Lang start + // ADT Languages start if (language == null) language = _language.GetCurrentLanguage(source); - // Lang end + // ADT Languages end var speech = GetSpeechVerb(source, message); @@ -427,16 +427,14 @@ private void SendEntitySpeak( if (nameEv.SpeechVerb != null && _prototypeManager.TryIndex(nameEv.SpeechVerb, out var proto)) speech = proto; } - // Lang start - // Accent fix start + // ADT Languages start bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation); // Capitalizing the word I only happens in English, so we check language here bool shouldCapitalizeTheWordI = (!CultureInfo.CurrentCulture.IsNeutralCulture && CultureInfo.CurrentCulture.Parent.Name == "en") || (CultureInfo.CurrentCulture.IsNeutralCulture && CultureInfo.CurrentCulture.Name == "en"); string coloredMessage = SanitizeInGameICMessage(source, FormattedMessage.EscapeText(message), out _, true, shouldPunctuate, shouldCapitalizeTheWordI); - // Accent fix end string coloredLanguageMessage = SanitizeInGameICMessage(source, _language.ObfuscateMessage(source, FormattedMessage.EscapeText(message), language), out _); @@ -448,7 +446,7 @@ private void SendEntitySpeak( coloredMessage = "[color=" + language.Color.Value.ToHex().ToString() + "]" + coloredMessage + "[/color]"; coloredLanguageMessage = "[color=" + language.Color.Value.ToHex().ToString() + "]" + coloredLanguageMessage + "[/color]"; } - // Lang end + // ADT Languages end name = FormattedMessage.EscapeText(name); var wrappedMessage = Loc.GetString(speech.Bold ? "chat-manager-entity-say-bold-wrap-message" : "chat-manager-entity-say-wrap-message", @@ -456,17 +454,18 @@ private void SendEntitySpeak( ("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))), ("fontType", speech.FontId), ("fontSize", speech.FontSize), - ("message", coloredMessage)); // Lang affected + ("message", coloredMessage)); // ADT Language colored msg - // Lang start + // ADT Languages start var wrappedLanguageMessage = Loc.GetString(speech.Bold ? "chat-manager-entity-say-bold-wrap-message" : "chat-manager-entity-say-wrap-message", ("entityName", name), ("verb", Loc.GetString(_random.Pick(speech.SpeechVerbStrings))), ("fontType", speech.FontId), ("fontSize", speech.FontSize), ("message", coloredLanguageMessage)); - // Lang end - SendInVoiceRange(ChatChannel.Local, message, wrappedMessage, wrappedLanguageMessage, source, range, language: language); // Lang affected + // ADT Languages end + + SendInVoiceRange(ChatChannel.Local, message, wrappedMessage, wrappedLanguageMessage, source, range, language: language); // ADT Languages var ev = new EntitySpokeEvent(source, message, language, null, null); RaiseLocalEvent(source, ev, true); @@ -502,7 +501,7 @@ private void SendEntityWhisper( string? nameOverride, bool hideLog = false, bool ignoreActionBlocker = false, - LanguagePrototype? language = null // Lang affected + LanguagePrototype? language = null // ADT Languages ) { if (!_actionBlocker.CanSpeak(source) && !ignoreActionBlocker) @@ -514,13 +513,13 @@ private void SendEntityWhisper( var obfuscatedMessage = ObfuscateMessageReadability(message, 0.2f); - // Lang start + // ADT Languages start if (language == null) language = _language.GetCurrentLanguage(source); var languageMessage = SanitizeInGameICMessage(source, _language.ObfuscateMessage(source, message, language), out _); var obfuscatedLanguageMessage = ObfuscateMessageReadability(SanitizeInGameICMessage(source, _language.ObfuscateMessage(source, message, language), out _), 0.2f); - // Lang end + // ADT Languages end // get the entity's name by visual identity (if no override provided). string nameIdentity = FormattedMessage.EscapeText(nameOverride ?? Identity.Name(source, EntityManager)); @@ -536,9 +535,8 @@ private void SendEntityWhisper( RaiseLocalEvent(source, nameEv); name = nameEv.Name; } - // Lang start + // ADT Languages start - // Accent fix start bool shouldPunctuate = _configurationManager.GetCVar(CCVars.ChatPunctuation); // Capitalizing the word I only happens in English, so we check language here bool shouldCapitalizeTheWordI = (!CultureInfo.CurrentCulture.IsNeutralCulture && CultureInfo.CurrentCulture.Parent.Name == "en") @@ -546,7 +544,6 @@ private void SendEntityWhisper( string coloredMessage = SanitizeInGameICMessage(source, FormattedMessage.EscapeText(message), out _, true, shouldPunctuate, shouldCapitalizeTheWordI); string coloredObfuscatedMessage = SanitizeInGameICMessage(source, FormattedMessage.EscapeText(obfuscatedMessage), out _, true, shouldPunctuate, shouldCapitalizeTheWordI); - // Accent fix end string coloredObfuscatedLanguageMessage = FormattedMessage.EscapeText(obfuscatedLanguageMessage); string coloredLanguageMessage = FormattedMessage.EscapeText(languageMessage); @@ -586,7 +583,8 @@ private void SendEntityWhisper( if (language == null) language = _language.GetCurrentLanguage(source); - // Lang end + // ADT Languages end + foreach (var (session, data) in GetRecipients(source, WhisperMuffledRange)) { EntityUid listener; @@ -598,7 +596,7 @@ private void SendEntityWhisper( if (MessageRangeCheck(session, data, range) != MessageRangeCheckResult.Full) continue; // Won't get logged to chat, and ghosts are too far away to see the pop-up, so we just won't send it to them. - // Lang start + // ADT Languages start if (!_language.CanUnderstand(source, language) && !_language.CheckTranslators(listener, source, language)) { if (data.Range <= WhisperClearRange) @@ -621,7 +619,7 @@ private void SendEntityWhisper( else _chatManager.ChatMessageToOne(ChatChannel.Whisper, obfuscatedMessage, wrappedUnknownMessage, source, false, session.Channel); } - // Lang end + // ADT Languages end } _replay.RecordServerMessage(new ChatMessage(ChatChannel.Whisper, message, wrappedMessage, GetNetEntity(source), null, MessageRangeHideChatForReplay(range))); @@ -673,7 +671,7 @@ private void SendEntityEmote( if (checkEmote) TryEmoteChatInput(source, action); - SendInVoiceRange(ChatChannel.Emotes, action, wrappedMessage, wrappedMessage, source, range, author, ignoreLanguage: true); // Lang affected + SendInVoiceRange(ChatChannel.Emotes, action, wrappedMessage, wrappedMessage, source, range, author, ignoreLanguage: true); // ADT Languages if (!hideLog) if (name != Name(source)) _adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user} as {name}: {action}"); @@ -700,7 +698,7 @@ private void SendLOOC(EntityUid source, ICommonSession player, string message, b ("entityName", name), ("message", FormattedMessage.EscapeText(message))); - SendInVoiceRange(ChatChannel.LOOC, message, wrappedMessage, wrappedMessage, source, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, player.UserId, ignoreLanguage: true); // Lang affected + SendInVoiceRange(ChatChannel.LOOC, message, wrappedMessage, wrappedMessage, source, hideChat ? ChatTransmitRange.HideChat : ChatTransmitRange.Normal, player.UserId, ignoreLanguage: true); // ADT Languages _adminLogger.Add(LogType.Chat, LogImpact.Low, $"LOOC from {player:Player}: {message}"); } @@ -781,9 +779,9 @@ private MessageRangeCheckResult MessageRangeCheck(ICommonSession session, ICChat /// /// Sends a chat message to the given players in range of the source entity. /// - private void SendInVoiceRange(ChatChannel channel, string message, string wrappedMessage, string wrappedLanguageMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? language = null, bool ignoreLanguage = false) // Lang affected + private void SendInVoiceRange(ChatChannel channel, string message, string wrappedMessage, string wrappedLanguageMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? language = null, bool ignoreLanguage = false) // ADT Languages { - // Lang start + // ADT Languages start if (language == null) language = _language.GetCurrentLanguage(source); @@ -810,7 +808,7 @@ private void SendInVoiceRange(ChatChannel channel, string message, string wrappe else _chatManager.ChatMessageToOne(channel, message, wrappedMessage, source, entHideChat, session.Channel, author: author); } - // Lang end + // ADT Languages end _replay.RecordServerMessage(new ChatMessage(channel, message, wrappedMessage, GetNetEntity(source), null, MessageRangeHideChatForReplay(range))); } diff --git a/Content.Server/Corvax/TTS/TTSSystem.cs b/Content.Server/Corvax/TTS/TTSSystem.cs index d18e4cbaea2..c8046212577 100644 --- a/Content.Server/Corvax/TTS/TTSSystem.cs +++ b/Content.Server/Corvax/TTS/TTSSystem.cs @@ -7,8 +7,8 @@ using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Random; -using Content.Server.Language; -using Content.Shared.Language; +using Content.Server.ADT.Language; // ADT Languages +using Content.Shared.ADT.Language; // ADT Languages namespace Content.Server.Corvax.TTS; @@ -20,7 +20,7 @@ public sealed partial class TTSSystem : EntitySystem [Dependency] private readonly TTSManager _ttsManager = default!; [Dependency] private readonly SharedTransformSystem _xforms = default!; [Dependency] private readonly IRobustRandom _rng = default!; - [Dependency] private readonly LanguageSystem _language = default!; + [Dependency] private readonly LanguageSystem _language = default!; // ADT Languages private readonly List _sampleText = new() @@ -90,11 +90,11 @@ private async void OnEntitySpoke(EntityUid uid, TTSComponent component, EntitySp if (args.ObfuscatedMessage != null) { - HandleWhisper(uid, args.Message, args.ObfuscatedMessage, protoVoice.Speaker, args.Language); + HandleWhisper(uid, args.Message, args.ObfuscatedMessage, protoVoice.Speaker, args.Language); // ADT Languages return; } - HandleSay(uid, args.Message, protoVoice.Speaker, args.Language); + HandleSay(uid, args.Message, protoVoice.Speaker, args.Language); // ADT Languages } private async void HandleSay(EntityUid uid, string message, string speaker, LanguagePrototype language) @@ -102,9 +102,10 @@ private async void HandleSay(EntityUid uid, string message, string speaker, Lang var soundData = await GenerateTTS(message, speaker); if (soundData is null) return; + // ADT Languages start var languageSoundData = await GenerateTTS(_language.ObfuscateMessage(uid, message, language), speaker); if (languageSoundData is null) return; - + // ADT Languages end RaiseNetworkEvent(new PlayTTSEvent(soundData, languageSoundData, language, GetNetEntity(uid)), Filter.Pvs(uid)); } @@ -114,17 +115,19 @@ private async void HandleWhisper(EntityUid uid, string message, string obfMessag var fullSoundData = await GenerateTTS(message, speaker, true); if (fullSoundData is null) return; - var fullLangSoundData = await GenerateTTS(_language.ObfuscateMessage(uid, message, language), speaker, true); - if (fullLangSoundData is null) return; - var obfSoundData = await GenerateTTS(obfMessage, speaker, true); if (obfSoundData is null) return; + // ADT Languages start + var fullLangSoundData = await GenerateTTS(_language.ObfuscateMessage(uid, message, language), speaker, true); + if (fullLangSoundData is null) return; + var obfLangSoundData = await GenerateTTS(_language.ObfuscateMessage(uid, obfMessage, language), speaker, true); if (obfLangSoundData is null) return; + // ADT Languages end - var fullTtsEvent = new PlayTTSEvent(fullSoundData, fullLangSoundData, language, GetNetEntity(uid), true); - var obfTtsEvent = new PlayTTSEvent(obfSoundData, obfLangSoundData, language, GetNetEntity(uid), true); + var fullTtsEvent = new PlayTTSEvent(fullSoundData, fullLangSoundData, language, GetNetEntity(uid), true); // ADT Languages + var obfTtsEvent = new PlayTTSEvent(obfSoundData, obfLangSoundData, language, GetNetEntity(uid), true); // ADT Languages // TODO: Check obstacles var xformQuery = GetEntityQuery(); diff --git a/Content.Server/EntityEffects/Effects/MakeSentient.cs b/Content.Server/EntityEffects/Effects/MakeSentient.cs index aad76a94ecf..72ef30578d9 100644 --- a/Content.Server/EntityEffects/Effects/MakeSentient.cs +++ b/Content.Server/EntityEffects/Effects/MakeSentient.cs @@ -3,7 +3,7 @@ using Content.Shared.EntityEffects; using Content.Shared.Mind.Components; using Robust.Shared.Prototypes; -using Content.Shared.Language; +using Content.Shared.ADT.Language; namespace Content.Server.EntityEffects.Effects; diff --git a/Content.Server/Mind/Commands/MakeSentientCommand.cs b/Content.Server/Mind/Commands/MakeSentientCommand.cs index 80a5c7b71eb..35244850406 100644 --- a/Content.Server/Mind/Commands/MakeSentientCommand.cs +++ b/Content.Server/Mind/Commands/MakeSentientCommand.cs @@ -6,7 +6,7 @@ using Content.Shared.Movement.Components; using Content.Shared.Speech; using Robust.Shared.Console; -using Content.Shared.Language; +using Content.Shared.ADT.Language; namespace Content.Server.Mind.Commands { diff --git a/Content.Server/Radio/EntitySystems/HeadsetSystem.cs b/Content.Server/Radio/EntitySystems/HeadsetSystem.cs index 34a8a4c2a58..f62ae1f5b3d 100644 --- a/Content.Server/Radio/EntitySystems/HeadsetSystem.cs +++ b/Content.Server/Radio/EntitySystems/HeadsetSystem.cs @@ -7,7 +7,7 @@ using Content.Shared.Radio.EntitySystems; using Robust.Shared.Network; using Robust.Shared.Player; -using Content.Server.Language; +using Content.Server.ADT.Language; // ADT Languages namespace Content.Server.Radio.EntitySystems; @@ -15,7 +15,7 @@ public sealed class HeadsetSystem : SharedHeadsetSystem { [Dependency] private readonly INetManager _netMan = default!; [Dependency] private readonly RadioSystem _radio = default!; - [Dependency] private readonly LanguageSystem _language = default!; + [Dependency] private readonly LanguageSystem _language = default!; // ADT Languages public override void Initialize() { @@ -103,10 +103,12 @@ private void OnHeadsetReceive(EntityUid uid, HeadsetComponent component, ref Rad { if (TryComp(Transform(uid).ParentUid, out ActorComponent? actor)) { + // ADT Languages start if (_language.CanUnderstand(Transform(uid).ParentUid, args.Language)) _netMan.ServerSendMessage(args.ChatMsg, actor.PlayerSession.Channel); else _netMan.ServerSendMessage(args.UnknownLanguageChatMsg, actor.PlayerSession.Channel); + // ADT Languages end } } diff --git a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs index b92142aa9a2..05db1e21e36 100644 --- a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs @@ -1,7 +1,7 @@ using System.Linq; using Content.Server.Chat.Systems; using Content.Server.Interaction; -using Content.Server.Language; +using Content.Server.ADT.Language; // ADT Languages using Content.Server.Popups; using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; @@ -27,7 +27,7 @@ public sealed class RadioDeviceSystem : EntitySystem [Dependency] private readonly RadioSystem _radio = default!; [Dependency] private readonly InteractionSystem _interaction = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!; - [Dependency] private readonly LanguageSystem _language = default!; + [Dependency] private readonly LanguageSystem _language = default!; // ADT Languages // Used to prevent a shitter from using a bunch of radios to spam chat. private HashSet<(string, EntityUid)> _recentlySent = new(); @@ -217,7 +217,7 @@ private void OnReceiveRadio(EntityUid uid, RadioSpeakerComponent component, ref ("originalName", nameEv.Name)); // log to chat so people can identity the speaker/source, but avoid clogging ghost chat if there are many radios - _chat.TrySendInGameICMessage(uid, args.Message, InGameICChatType.Whisper, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false, language: args.Language); + _chat.TrySendInGameICMessage(uid, args.Message, InGameICChatType.Whisper, ChatTransmitRange.GhostRangeLimit, nameOverride: name, checkRadioPrefix: false, language: args.Language); // ADT Languages } private void OnIntercomEncryptionChannelsChanged(Entity ent, ref EncryptionChannelsChangedEvent args) diff --git a/Content.Server/Radio/EntitySystems/RadioSystem.cs b/Content.Server/Radio/EntitySystems/RadioSystem.cs index f5566bcc190..68bcc859489 100644 --- a/Content.Server/Radio/EntitySystems/RadioSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioSystem.cs @@ -15,8 +15,8 @@ using Robust.Shared.Random; using Robust.Shared.Replays; using Robust.Shared.Utility; -using Content.Server.Language; -using Content.Shared.Language; +using Content.Server.ADT.Language; // ADT Languages +using Content.Shared.ADT.Language; // ADT Languages namespace Content.Server.Radio.EntitySystems; @@ -31,7 +31,7 @@ public sealed class RadioSystem : EntitySystem [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ChatSystem _chat = default!; - [Dependency] private readonly LanguageSystem _language = default!; + [Dependency] private readonly LanguageSystem _language = default!; // ADT Languages // set used to prevent radio feedback loops. private readonly HashSet _messages = new(); @@ -60,10 +60,12 @@ private void OnIntrinsicReceive(EntityUid uid, IntrinsicRadioReceiverComponent c { if (TryComp(uid, out ActorComponent? actor)) { + // ADT Languages start if (_language.CanUnderstand(uid, args.Language)) _netMan.ServerSendMessage(args.ChatMsg, actor.PlayerSession.Channel); else _netMan.ServerSendMessage(args.UnknownLanguageChatMsg, actor.PlayerSession.Channel); + // ADT Languages end } } @@ -109,6 +111,7 @@ public void SendRadioMessage(EntityUid messageSource, string message, RadioChann ? FormattedMessage.EscapeText(message) : message; + // ADT Languages start var languageEncodedContent = _language.ObfuscateMessage(messageSource, content, language); if (language.Color != null) @@ -116,6 +119,7 @@ public void SendRadioMessage(EntityUid messageSource, string message, RadioChann content = "[color=" + language.Color.Value.ToHex().ToString() + "]" + FormattedMessage.EscapeText(content) + "[/color]"; languageEncodedContent = "[color=" + language.Color.Value.ToHex().ToString() + "]" + FormattedMessage.EscapeText(languageEncodedContent) + "[/color]"; } + // ADT Languages end var wrappedMessage = Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap", ("color", channel.Color), @@ -126,6 +130,7 @@ public void SendRadioMessage(EntityUid messageSource, string message, RadioChann ("name", name), ("message", content)); + // ADT Languages start var wrappedEncodedMessage = Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap", ("color", channel.Color), ("fontType", speech.FontId), @@ -134,6 +139,7 @@ public void SendRadioMessage(EntityUid messageSource, string message, RadioChann ("channel", $"\\[{channel.LocalizedName}\\]"), ("name", name), ("message", languageEncodedContent)); + // ADT Languages end // most radios are relayed to chat, so lets parse the chat message beforehand var chat = new ChatMessage( @@ -143,17 +149,19 @@ public void SendRadioMessage(EntityUid messageSource, string message, RadioChann NetEntity.Invalid, null); + // ADT Languages start var encodedChat = new ChatMessage( ChatChannel.Radio, message, wrappedEncodedMessage, NetEntity.Invalid, null); + // ADT Languages end var chatMsg = new MsgChatMessage { Message = chat }; - var encodedChatMsg = new MsgChatMessage { Message = chat }; + var encodedChatMsg = new MsgChatMessage { Message = encodedChat }; // ADT Languages - var ev = new RadioReceiveEvent(message, messageSource, channel, radioSource, chatMsg, encodedChatMsg, language); + var ev = new RadioReceiveEvent(message, messageSource, channel, radioSource, chatMsg, encodedChatMsg, language); // ADT Languages var sendAttemptEv = new RadioSendAttemptEvent(channel, radioSource); RaiseLocalEvent(ref sendAttemptEv); diff --git a/Content.Server/Radio/RadioEvent.cs b/Content.Server/Radio/RadioEvent.cs index fbc862df13b..4cdc4213e2f 100644 --- a/Content.Server/Radio/RadioEvent.cs +++ b/Content.Server/Radio/RadioEvent.cs @@ -1,11 +1,11 @@ using Content.Shared.Chat; using Content.Shared.Radio; -using Content.Shared.Language; // Lang affected +using Content.Shared.ADT.Language; // ADT Languages namespace Content.Server.Radio; [ByRefEvent] -public readonly record struct RadioReceiveEvent(string Message, EntityUid MessageSource, RadioChannelPrototype Channel, EntityUid RadioSource, MsgChatMessage ChatMsg, MsgChatMessage UnknownLanguageChatMsg, LanguagePrototype Language); // Lang affected +public readonly record struct RadioReceiveEvent(string Message, EntityUid MessageSource, RadioChannelPrototype Channel, EntityUid RadioSource, MsgChatMessage ChatMsg, MsgChatMessage UnknownLanguageChatMsg, LanguagePrototype Language); // ADT Languages /// /// Use this event to cancel sending message per receiver diff --git a/Content.Shared/ADT/Language/Components/HandheldTranslatorComponent.cs b/Content.Shared/ADT/Language/Components/HandheldTranslatorComponent.cs index 86aafe3e68c..93aabaf7e13 100644 --- a/Content.Shared/ADT/Language/Components/HandheldTranslatorComponent.cs +++ b/Content.Shared/ADT/Language/Components/HandheldTranslatorComponent.cs @@ -3,7 +3,7 @@ using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -namespace Content.Shared.Language; +namespace Content.Shared.ADT.Language; [RegisterComponent, NetworkedComponent] public sealed partial class HandheldTranslatorComponent : Component diff --git a/Content.Shared/ADT/Language/Components/LanguageSpeakerComponent.cs b/Content.Shared/ADT/Language/Components/LanguageSpeakerComponent.cs index b524a1abe3f..66da42ef2fd 100644 --- a/Content.Shared/ADT/Language/Components/LanguageSpeakerComponent.cs +++ b/Content.Shared/ADT/Language/Components/LanguageSpeakerComponent.cs @@ -1,7 +1,7 @@ using Robust.Shared.Prototypes; using Robust.Shared.GameStates; -namespace Content.Shared.Language; +namespace Content.Shared.ADT.Language; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class LanguageSpeakerComponent : Component diff --git a/Content.Shared/ADT/Language/LanguagePrototype.cs b/Content.Shared/ADT/Language/LanguagePrototype.cs index 598b14f14cc..1361ae28940 100644 --- a/Content.Shared/ADT/Language/LanguagePrototype.cs +++ b/Content.Shared/ADT/Language/LanguagePrototype.cs @@ -2,7 +2,7 @@ using Robust.Shared.GameStates; using Robust.Shared.Serialization; -namespace Content.Shared.Language; +namespace Content.Shared.ADT.Language; [Prototype("language")] public sealed class LanguagePrototype : IPrototype diff --git a/Content.Shared/ADT/Language/Systems/SharedLanguageSystem.cs b/Content.Shared/ADT/Language/Systems/SharedLanguageSystem.cs index 4f940f232e2..98deab329fb 100644 --- a/Content.Shared/ADT/Language/Systems/SharedLanguageSystem.cs +++ b/Content.Shared/ADT/Language/Systems/SharedLanguageSystem.cs @@ -6,7 +6,7 @@ using Content.Shared.Ghost; using Robust.Shared.Network; -namespace Content.Shared.Language; +namespace Content.Shared.ADT.Language; public abstract class SharedLanguageSystem : EntitySystem { diff --git a/Content.Shared/ADT/Language/Systems/SharedTranslatorImplantSystem.cs b/Content.Shared/ADT/Language/Systems/SharedTranslatorImplantSystem.cs index 0fad22f50f0..abb3cf95cd9 100644 --- a/Content.Shared/ADT/Language/Systems/SharedTranslatorImplantSystem.cs +++ b/Content.Shared/ADT/Language/Systems/SharedTranslatorImplantSystem.cs @@ -8,7 +8,7 @@ using JetBrains.Annotations; using Robust.Shared.Containers; using Robust.Shared.Network; -using Content.Shared.Language; +using Content.Shared.ADT.Language; namespace Content.Shared.Implants; diff --git a/Content.Shared/ADT/Language/Systems/SharedTranslatorSystem.cs b/Content.Shared/ADT/Language/Systems/SharedTranslatorSystem.cs index 1cb350a658c..8e5353d3b4c 100644 --- a/Content.Shared/ADT/Language/Systems/SharedTranslatorSystem.cs +++ b/Content.Shared/ADT/Language/Systems/SharedTranslatorSystem.cs @@ -1,7 +1,7 @@ using Content.Shared.Examine; using Content.Shared.Toggleable; -namespace Content.Shared.Language; +namespace Content.Shared.ADT.Language; public abstract class SharedTranslatorSystem : EntitySystem { diff --git a/Content.Shared/Corvax/TTS/PlayTTSEvent.cs b/Content.Shared/Corvax/TTS/PlayTTSEvent.cs index 24aab224d1c..144f32b71a4 100644 --- a/Content.Shared/Corvax/TTS/PlayTTSEvent.cs +++ b/Content.Shared/Corvax/TTS/PlayTTSEvent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Language; +using Content.Shared.ADT.Language; // ADT Languages using Robust.Shared.Serialization; namespace Content.Shared.Corvax.TTS; @@ -11,13 +11,13 @@ public sealed class PlayTTSEvent : EntityEventArgs public byte[] LanguageData { get; } public NetEntity? SourceUid { get; } public bool IsWhisper { get; } - public string LanguageProtoId { get; } - public PlayTTSEvent(byte[] data, byte[] languageData, LanguagePrototype language, NetEntity? sourceUid = null, bool isWhisper = false) + public string LanguageProtoId { get; } // ADT Languages + public PlayTTSEvent(byte[] data, byte[] languageData, LanguagePrototype language, NetEntity? sourceUid = null, bool isWhisper = false) // ADT Languages { Data = data; SourceUid = sourceUid; IsWhisper = isWhisper; - LanguageProtoId = language.ID; - LanguageData = languageData; + LanguageProtoId = language.ID; // ADT Languages + LanguageData = languageData; // ADT Languages } } diff --git a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/handheld.yml b/Resources/Prototypes/ADT/Entities/Objects/Device/handheld.yml similarity index 99% rename from Resources/Prototypes/ADT/Entities/Objects/Device/Translators/handheld.yml rename to Resources/Prototypes/ADT/Entities/Objects/Device/handheld.yml index 12ac3ee751b..7dd3cd21720 100644 --- a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/handheld.yml +++ b/Resources/Prototypes/ADT/Entities/Objects/Device/handheld.yml @@ -1,3 +1,4 @@ +# Translators - type: entity id: TranslatorUnpowered parent: [ BaseItem ] diff --git a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implanters.yml b/Resources/Prototypes/ADT/Entities/Objects/Misc/implanters.yml similarity index 99% rename from Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implanters.yml rename to Resources/Prototypes/ADT/Entities/Objects/Misc/implanters.yml index 0500bf469c7..8abe4059289 100644 --- a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implanters.yml +++ b/Resources/Prototypes/ADT/Entities/Objects/Misc/implanters.yml @@ -1,3 +1,4 @@ +# Translators - type: entity id: GalacticCommonTranslatorImplanter name: Galactic Common Translator implanter diff --git a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implants.yml b/Resources/Prototypes/ADT/Entities/Objects/Misc/subdermal_implants.yml similarity index 99% rename from Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implants.yml rename to Resources/Prototypes/ADT/Entities/Objects/Misc/subdermal_implants.yml index 702dce1a09b..2bd1b012801 100644 --- a/Resources/Prototypes/ADT/Entities/Objects/Device/Translators/implants.yml +++ b/Resources/Prototypes/ADT/Entities/Objects/Misc/subdermal_implants.yml @@ -1,3 +1,4 @@ +# Translators - type: entity id: BaseTranslatorImplant abstract: true diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 4a13a996112..19619610109 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -360,6 +360,9 @@ - ArkaneTranslatorImplanter - ShadowkinTranslatorImplanter - CintaTajTranslatorImplanter + - IPCTranslatorImplanter + - BorgTranslatorImplanter + - DwarfTranslatorImplanter - UrsTranslator - ArkaneTranslator - ShadowkinTranslator