Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Отображение языка в чате и прочее #288

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ public string WrapWhisperMessage(EntityUid source, LocId defaultWrap, string ent
public string WrapMessage(LocId wrapId, InGameICChatType chatType, EntityUid source, string entityName, string message, LanguagePrototype? language)
{
language ??= _language.GetLanguage(source);

if (language.SpeechOverride.MessageWrapOverrides.TryGetValue(chatType, out var wrapOverride))
wrapId = wrapOverride;

Expand All @@ -878,6 +879,10 @@ public string WrapMessage(LocId wrapId, InGameICChatType chatType, EntityUid sou
? _random.Pick(verbsOverride).ToString()
: _random.Pick(speech.SpeechVerbStrings);
var color = DefaultSpeakColor;
var languageDisplay = language.IsVisibleLanguage
? $"{language.ChatName} | "
: "";

if (language.SpeechOverride.Color is { } colorOverride)
color = Color.InterpolateBetween(color, colorOverride, colorOverride.A);

Expand All @@ -887,7 +892,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));
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Radio/EntitySystems/RadioSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,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} | "
: "";
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved

return Loc.GetString(speech.Bold ? "chat-radio-message-wrap-bold" : "chat-radio-message-wrap",
("color", channel.Color),
Expand All @@ -192,7 +195,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));
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
}

/// <inheritdoc cref="TelecomServerComponent"/>
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/Language/LanguagePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace Content.Shared.Language;
public sealed class LanguagePrototype : IPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;
public string ID { get; private set; } = default!;
[DataField("isvisiblelanguage")]
public bool IsVisibleLanguage { get; set; }
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Необходима доработка: Публичный сеттер IsVisibleLanguage не используется

В ходе проверки было выявлено, что свойство IsVisibleLanguage нигде не изменяется в кодовой базе, а только читается в нескольких местах. Это означает, что публичный сеттер может быть избыточным и потенциально позволяет нежелательные изменения значения свойства во время выполнения.

  • Рекомендация: Сделать сеттер IsVisibleLanguage приватным, если изменение свойства не требуется вне класса. Если публичный сеттер необходим для сериализации или других целей, убедитесь, что это задокументировано и оправдано.
🔗 Analysis chain

Одобрено: Добавление свойства IsVisibleLanguage

Новое свойство IsVisibleLanguage соответствует цели PR по отображению языка в чате. Это хорошее дополнение к классу LanguagePrototype.

Однако, стоит обратить внимание на публичный сеттер. Убедитесь, что это намеренное решение, позволяющее изменять видимость языка во время выполнения. Если такая функциональность не требуется, рассмотрите возможность сделать сеттер приватным или удалить его вовсе.

Для проверки использования IsVisibleLanguage, выполните следующий скрипт:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Описание: Проверка использования свойства IsVisibleLanguage

# Поиск мест, где устанавливается значение IsVisibleLanguage
echo "Места, где устанавливается IsVisibleLanguage:"
rg "IsVisibleLanguage\s*=|set;\s*$" --type csharp

# Поиск мест, где считывается значение IsVisibleLanguage
echo "\nМеста, где считывается IsVisibleLanguage:"
rg "\.IsVisibleLanguage" --type csharp

Length of output: 11524


/// <summary>
/// Obfuscation method used by this language. By default, uses <see cref="ObfuscationMethod.Default"/>
Expand All @@ -26,6 +28,7 @@ public sealed class LanguagePrototype : IPrototype
/// The in-world name of this language, localized.
/// </summary>
public string Name => Loc.GetString($"language-{ID}-name");
public string ChatName => Loc.GetString($"chat-language-{ID}-name");
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// The in-world description of this language, localized.
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/_LostParadise/Jobs/jobs.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ job-description-lppparamedic = Следите за жизнями экипажа
job-name-adjutant = Адъютант
job-description-adjutant = Вы помощник всего коммандования, слушайте рацию и набирайтесь опыта в работе всей структуры.
JobLPPadjutant = Адъютант
JobLPPBlueShieldOfficer = Офицер "Синий щит"
JobLPPBlueShieldOfficer = Офицер "Синий Щит"
job-name-centcom-representative = представитель ЦентКом
job-name-blueshieldofficer = Офицер "Синий щит"
job-name-blueshieldofficer = Офицер "Синий Щит"
job-description-blueshieldofficer = Ваша задача защитить всех глав на станции. Следите за ними
department-Law = Юридический отдел
department-CentCom = Центральное Командование
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/ru-RU/_LostParadise/Jobs/jobs.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ job-description-lppparamedic = Следите за жизнями экипажа
job-name-adjutant = Адъютант
job-description-adjutant = Вы помощник всего коммандования, слушайте рацию и набирайтесь опыта в работе всей структуры.
JobLPPadjutant = Адъютант
JobLPPBlueShieldOfficer = Офицер "Синий щит"
JobLPPBlueShieldOfficer = Офицер "Синий Щит"
job-name-centcom-representative = представитель ЦентКом
job-name-blueshieldofficer = Офицер "Синий щит"
job-name-blueshieldofficer = Офицер "Синий Щит"
job-description-blueshieldofficer = Ваша задача защитить всех глав на станции. Следите за ними
department-Law = Юридический отдел
department-CentCom = Центральное Командование
Expand Down
33 changes: 33 additions & 0 deletions Resources/Locale/ru-RU/chat/managers/chat-language.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
chat-language-ElfLang-name = Эльфийский
chat-language-DwarfLang-name = Дварфский
chat-language-LPPSikTaj-name = Сик' таяран
chat-language-Universal-name = Универсальный
chat-language-Bubblish-name = Пузырчатый
chat-language-RootSpeak-name = Песнь корней
chat-language-Nekomimetic-name = Неко
chat-language-Draconic-name = Синта'унати
chat-language-Azaziba-name = Синта'Азазиба
chat-language-SolCommon-name = Солнечный
chat-language-TauCetiBasic-name = Общегалактический
chat-language-Tradeband-name = Торговый
chat-language-Freespeak-name = Свободный
chat-language-Elyran-name = Элиранский
chat-language-Canilunzt-name = Канилунц
chat-language-Moffic-name = Ткачий
chat-language-RobotTalk-name = Робо
chat-language-ValyrianStandard-name = Валирийский
chat-language-Cat-name = Кошачий
chat-language-Dog-name = Собачий
chat-language-Fox-name = Лисичий
chat-language-Xeno-name = Ксено
chat-language-Monkey-name = Обезьяний
chat-language-Mouse-name = Мышиный
chat-language-Chicken-name = Куриный
chat-language-Duck-name = Утиный
chat-language-Cow-name = Коровий
chat-language-Sheep-name = Овечий
chat-language-Kangaroo-name = Кенгуручий
chat-language-Pig-name = Свиной
chat-language-Crab-name = Крабий
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
chat-language-Kobold-name = Кобольдский
chat-language-Hissing-name = Паучий
6 changes: 3 additions & 3 deletions Resources/Locale/ru-RU/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ chat-manager-whisper-headset-on-message = Вы не можете шептать
chat-manager-server-wrap-message = [bold]{ $message }[/bold]
chat-manager-sender-announcement-wrap-message = [font size=14][bold]Объявление { $sender }:[/font][font size=12]
{ $message }[/bold][/font]
chat-manager-entity-say-wrap-message = [BubbleHeader][bold][Name]{ $entityName }[/Name][/bold][/BubbleHeader] { $verb }, [font={ $fontType } size={ $fontSize } ]"[BubbleContent]{ $message }[/BubbleContent]"[/font]
chat-manager-entity-say-bold-wrap-message = [BubbleHeader][bold][Name]{ $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] шепчет,"[BubbleContent]{ $message }[/BubbleContent]"[/italic][/font]
chat-manager-entity-say-wrap-message = [BubbleHeader][bold][Name]{ $language }{ $entityName }[/Name][/bold][/BubbleHeader] { $verb }, [font={ $fontType } size={ $fontSize } ]"[BubbleContent]{ $message }[/BubbleContent]"[/font]
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
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]
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
chat-manager-entity-whisper-wrap-message = [font size=11][italic][BubbleHeader][Name]{ $language }{ $entityName }[/Name][/BubbleHeader] шепчет,"[BubbleContent]{ $message }[/BubbleContent]"[/italic][/font]
chat-manager-entity-whisper-unknown-wrap-message = [font size=11][italic][BubbleHeader]Кто-то[/BubbleHeader] шепчет, "[BubbleContent]{ $message }[/BubbleContent]"[/italic][/font]
chat-manager-entity-me-wrap-message = [italic]{ $entityName } { $message }[/italic]
chat-manager-entity-looc-wrap-message = LOOC: [bold]{ $entityName }:[/bold] { $message }
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/ru-RU/headset/headset-component.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chat window radio wrap (prefix and postfix)
chat-radio-message-wrap = [color={ $color }]{ $channel } [bold]{ $name }[/bold] { $verb }, [font={ $fontType } size={ $fontSize }]"{ $message }"[/font][/color]
chat-radio-message-wrap-bold = [color={ $color }]{ $channel } [bold]{ $name }[/bold] { $verb }, [font={ $fontType } size={ $fontSize }][bold]"{ $message }"[/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 = Отображается, что каналом по умолчанию этой гарнитуры является [color={ $color }]{ $channel }[/color].
chat-radio-common = Общий
chat-radio-centcom = Центком
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ent-LPPSecurityEngineerPDA = КПК полевого инженера
.desc = Красный, чтобы скрыть пятна крови пассажиров.
ent-LPPBlueShieldOfficerPDA = КПК офицера "Синий щит"
ent-LPPBlueShieldOfficerPDA = КПК офицера "Синий Щит"
.desc = Пахнет защитой.
ent-LPPAdjutantPDA = КПК Адъютанта
.desc = Пора почувствовать себя крутым.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ent-LPPBlueshieldlaser = Лазерный револьвер офицера "Синий Щит"
.desc = Скорострельный лазерный револьвер, стоящий на вооружении всего отряда представителей "Синий щит".
.desc = Скорострельный лазерный револьвер, стоящий на вооружении всего отряда представителей "Синий Щит".
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ent-LPPLockerBlueShield = Шкафчик офицера "Синий щит"
ent-LPPLockerBlueShield = Шкафчик офицера "Синий Щит"
.desc = { ent-LockerBaseSecure.desc }
ent-LPPLockerSecEng = Шкаф полевого инженера
.desc = { ent-LockerBaseSecure.desc }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ent-LPPSpawnBlueShieldOfficer = Офицер "Синий щит"
ent-LPPSpawnBlueShieldOfficer = Офицер "Синий Щит"
.desc = { ent-SpawnPointJobBase.desc }
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@
- MagazineBoxRifle
- MagazineBoxLightRifle
- SpeedLoaderMagnum
- MagazineMagnum
- MagazineUniversalMagnum
- ClothingOuterArmorPlateCarrier # DeltaV - plate carrier body armour
- ClothingOuterArmorDuraVest # DeltaV - stabproof vest body armour
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Species-Specific/diona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# TODO: Replace this with a much better language.
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
- type: language
id: RootSpeak
isvisiblelanguage: true
speech:
color: "#ce5e14dd"
fontId: Noganas
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Species-Specific/harpy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: language
id: ValyrianStandard
isvisiblelanguage: true
speech:
fontId: Cambria
color: "#008ecc"
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Species-Specific/moth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# TODO: Replace this with a much better language.
- type: language
id: Moffic
isvisiblelanguage: true
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
speech:
color: "#c7df2edd"
fontId: Copperplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# TODO: Replace this with a much better language.
- type: language
id: Nekomimetic
isvisiblelanguage: true
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
speech:
color: "#df57aaee"
fontId: Manga
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Spoken by Unathi.
- type: language
id: Draconic
isvisiblelanguage: true
speech:
color: "#2aca2add"
obfuscation:
Expand Down Expand Up @@ -97,6 +98,7 @@
# !Do Not Make A Translator For This Language.
- type: language
id: Azaziba
isvisiblelanguage: true
speech:
color: "#2aca2add"
obfuscation:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# TODO: Replace this with a much better language.
- type: language
id: Bubblish
isvisiblelanguage: true
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
speech:
color: "#00a3e2dd"
fontId: RubikBubbles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# TODO: Replace this with a much better language.
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
- type: language
id: Canilunzt
isvisiblelanguage: true
speech:
color: "#d69b3dcc"
obfuscation:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Standard/elyran.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: language
id: Elyran
isvisiblelanguage: true
speech:
color: "#8282fbaa"
obfuscation:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Standard/freespeak.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: language
id: Freespeak
isvisiblelanguage: true
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
speech:
color: "#597d35"
obfuscation:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Standard/solcommon.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: language
id: SolCommon
isvisiblelanguage: true
speech:
color: "#8282fbaa"
obfuscation:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Standard/taucetibasic.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# The "Default Language" other than Universal.
- type: language
id: TauCetiBasic
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Language/Standard/tradeband.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- type: language
id: Tradeband
isvisiblelanguage: true
Farrellka-dev marked this conversation as resolved.
Show resolved Hide resolved
speech:
color: "#597d35"
obfuscation:
Expand Down
15 changes: 15 additions & 0 deletions Resources/Prototypes/Language/animal.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Languages spoken by various critters.
- type: language
id: Cat
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -13,6 +14,7 @@

- type: language
id: Dog
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -27,6 +29,7 @@

- type: language
id: Fox
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -42,6 +45,7 @@

- type: language
id: Xeno
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -52,6 +56,7 @@

- type: language
id: Monkey
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -62,6 +67,7 @@

- type: language
id: Mouse
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 2
Expand All @@ -78,6 +84,7 @@

- type: language
id: Chicken
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -89,6 +96,7 @@

- type: language
id: Duck
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -100,6 +108,7 @@

- type: language
id: Cow
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -110,6 +119,7 @@

- type: language
id: Sheep
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -121,6 +131,7 @@

- type: language
id: Kangaroo
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -133,6 +144,7 @@

- type: language
id: Pig
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -143,6 +155,7 @@

- type: language
id: Crab
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 1
Expand All @@ -158,6 +171,7 @@

- type: language
id: Kobold
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 2
Expand All @@ -177,6 +191,7 @@

- type: language
id: Hissing
isvisiblelanguage: false
obfuscation:
!type:SyllableObfuscation
minSyllables: 2
Expand Down
Loading
Loading