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

Sign Language! #439

Closed
Closed
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
46 changes: 41 additions & 5 deletions Content.Server/Chat/Systems/ChatSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ public void TrySendInGameICMessage(
if (string.IsNullOrEmpty(message))
return;

// Check if the message is in sign language
if (desiredType == InGameICChatType.Speak || desiredType == InGameICChatType.Whisper)
{
var language = languageOverride ?? _language.GetLanguage(source);
if (language.SignLanguage)
{
SendEntityEmote(source, message, range, nameOverride,
ignoreActionBlocker, signLanguage: true);
return;
}
}

// This message may have a radio prefix, and should then be whispered to the resolved radio channel
if (checkRadioPrefix)
{
Expand Down Expand Up @@ -570,7 +582,8 @@ private void SendEntityEmote(
bool hideLog = false,
bool checkEmote = true,
bool ignoreActionBlocker = false,
NetUserId? author = null
NetUserId? author = null,
bool? signLanguage = false
)
{
if (!_actionBlocker.CanEmote(source) && !ignoreActionBlocker)
Expand All @@ -581,14 +594,29 @@ private void SendEntityEmote(
string name = FormattedMessage.EscapeText(nameOverride ?? Name(ent));

// Emotes use Identity.Name, since it doesn't actually involve your voice at all.
var wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
var wrappedMessage = "";
var obfuscatedWrappedMessage = "";
if (signLanguage == true)
{
wrappedMessage = Loc.GetString("chat-manager-entity-signlanguage-message",
("entityName", name),
("message", FormattedMessage.EscapeText(action)));

obfuscatedWrappedMessage = Loc.GetString("chat-manager-entity-signlanguage-obfuscated",
("entityName", name));
}
else
{
wrappedMessage = Loc.GetString("chat-manager-entity-me-wrap-message",
("entityName", name),
("entity", ent),
("message", FormattedMessage.RemoveMarkup(action)));
}

if (checkEmote)
TryEmoteChatInput(source, action);
SendInVoiceRange(ChatChannel.Emotes, name, action, wrappedMessage, obfuscated: "", obfuscatedWrappedMessage: "", source, range, author);
SendInVoiceRange(ChatChannel.Emotes, name, action, wrappedMessage, obfuscated: "",
obfuscatedWrappedMessage, source, range, author, null, true);
if (!hideLog)
if (name != Name(source))
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"Emote from {ToPrettyString(source):user} as {name}: {action}");
Expand Down Expand Up @@ -702,7 +730,7 @@ private MessageRangeCheckResult MessageRangeCheck(ICommonSession session, ICChat
/// <summary>
/// Sends a chat message to the given players in range of the source entity.
/// </summary>
private void SendInVoiceRange(ChatChannel channel, string name, string message, string wrappedMessage, string obfuscated, string obfuscatedWrappedMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? languageOverride = null)
private void SendInVoiceRange(ChatChannel channel, string name, string message, string wrappedMessage, string obfuscated, string obfuscatedWrappedMessage, EntityUid source, ChatTransmitRange range, NetUserId? author = null, LanguagePrototype? languageOverride = null, bool? signLanguage = false)
{
var language = languageOverride ?? _language.GetLanguage(source);
foreach (var (session, data) in GetRecipients(source, VoiceRange))
Expand All @@ -715,9 +743,17 @@ private void SendInVoiceRange(ChatChannel channel, string name, string message,
continue;
EntityUid listener = session.AttachedEntity.Value;

// Quickly Checking if the Emote is a real one or Sign Language.
var notSignLanguage = false;
if (channel == ChatChannel.Emotes)
{
notSignLanguage = true;
if (signLanguage == true)
notSignLanguage = false;
}

// If the channel does not support languages, or the entity can understand the message, send the original message, otherwise send the obfuscated version
if (channel == ChatChannel.LOOC || channel == ChatChannel.Emotes || _language.CanUnderstand(listener, language))
if (channel == ChatChannel.LOOC || notSignLanguage || _language.CanUnderstand(listener, language))
{
_chatManager.ChatMessageToOne(channel, message, wrappedMessage, source, entHideChat, session.Channel, author: author);
}
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Language/LanguagePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public sealed class LanguagePrototype : IPrototype
[DataField(required: true)]
public bool ObfuscateSyllables;

// <summary>
// If true, will mark the language as a SignLanguage and will be handled as such.
// </summary>
[DataField]
public bool SignLanguage;
FoxxoTrystan marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Lists all syllables that are used to obfuscate a message a listener cannot understand if obfuscateSyllables is true.
/// Otherwise uses all possible phrases the creature can make when trying to say anything.
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/chat/managers/chat-manager.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ chat-manager-entity-me-wrap-message = [italic]{ PROPER($entity) ->
[true] {$entityName} {$message}[/italic]
}

chat-manager-entity-signlanguage-message = [italic]{$entityName} signs "[BubbleContent]{$message}[/BubbleContent]"[/italic]
chat-manager-entity-signlanguage-obfuscated = [italic]{$entityName} signs something.[/italic]

chat-manager-entity-looc-wrap-message = LOOC: {$entityName}: {$message}
chat-manager-send-ooc-wrap-message = OOC: {$playerName}: {$message}
chat-manager-send-ooc-patron-wrap-message = OOC: [color={$patronColor}]{$playerName}[/color]: {$message}
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/language/languages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ language-Universal-description = What are you?
language-GalacticCommon-name = Galactic common
language-GalacticCommon-description = The standard Galatic language, most commonly used for inter-species communications and legal work.

language-SignLanguage-name = Sign Language
language-SignLanguage-description = The standard Galactic sign language, used by those that are unable to speak Galactic Common or at all.

language-Bubblish-name = Bubblish
language-Bubblish-description = The language of Slimes. Being a mixture of bubbling noises and pops it's very difficult to speak for humans without the use of mechanical aids.

Expand Down
8 changes: 8 additions & 0 deletions Resources/Prototypes/Language/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
- nah
- wah

# The common galactic Sign Language!
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# The common galactic Sign Language!

- type: language
id: SignLanguage
signLanguage: true
FoxxoTrystan marked this conversation as resolved.
Show resolved Hide resolved
obfuscateSyllables: false
replacement:
- "*incomprehensible*"
Copy link
Member

Choose a reason for hiding this comment

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

Put some things like these

Suggested change
- "*incomprehensible*"
- signs something
- makes weird hand gestures

Copy link
Member Author

Choose a reason for hiding this comment

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

Replacement is never heart its is just a placeholder for Replacement value.

Copy link
Member

Choose a reason for hiding this comment

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

Make it used

Copy link
Member Author

Choose a reason for hiding this comment

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

Its uses .ftl files.
I cannot translate replacement.

Copy link
Member

Choose a reason for hiding this comment

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

All of these should be localized but this one prototype shouldn't be any different from any other.


# Spoken by slimes.
- type: language
id: Bubblish
Expand Down
Loading