From 17aca3c851ddad88e812b7002dd3f222de6d6796 Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Tue, 6 Aug 2024 00:55:31 +0800 Subject: [PATCH] New Trait: Sign Language (#677) # Description **Sign Language** is a 1-point Visual trait that allows you to use Galactic Sign Language. ## Media ![image](https://github.com/user-attachments/assets/ef9a3ed0-6157-4604-9db4-d7114595195b) ![image](https://github.com/user-attachments/assets/805b4a8f-a2d3-469c-b4ab-e46c787a55b6) # Changelog :cl: Skubman - add: Add a new 1-point trait called Sign Language, a trait that allows you to communicate in Galactic Sign Language. --------- Signed-off-by: Angelo Fallaria --- .../LanguageKnowledgeModifierComponent.cs | 23 ++++++++++++ .../LanguageKnowledgeModifierSystem.cs | 35 +++++++++++++++++++ Resources/Locale/en-US/language/languages.ftl | 6 ++-- Resources/Locale/en-US/traits/traits.ftl | 5 +++ Resources/Prototypes/Traits/skills.yml | 11 ++++++ 5 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 Content.Server/Traits/Assorted/LanguageKnowledgeModifierComponent.cs create mode 100644 Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs diff --git a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierComponent.cs b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierComponent.cs new file mode 100644 index 00000000000..170dae40fa6 --- /dev/null +++ b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierComponent.cs @@ -0,0 +1,23 @@ +using Content.Shared.Language; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; + +namespace Content.Server.Traits.Assorted; + +/// +/// Used for traits that modify entities' language knowledge. +/// +[RegisterComponent] +public sealed partial class LanguageKnowledgeModifierComponent : Component +{ + /// + /// List of languages this entity will learn to speak. + /// + [DataField("speaks")] + public List NewSpokenLanguages = new(); + + /// + /// List of languages this entity will learn to understand. + /// + [DataField("understands")] + public List NewUnderstoodLanguages = new(); +} diff --git a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs new file mode 100644 index 00000000000..9053c9404fe --- /dev/null +++ b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs @@ -0,0 +1,35 @@ +using System.Linq; +using Content.Server.Language; +using Content.Shared.Language.Components; + +namespace Content.Server.Traits.Assorted; + +public sealed class LanguageKnowledgeModifierSystem : EntitySystem +{ + [Dependency] private readonly LanguageSystem _languages = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnStartup); + } + + private void OnStartup(Entity entity, ref ComponentInit args) + { + if (!TryComp(entity, out var knowledge)) + { + Log.Warning($"Entity {entity.Owner} does not have a LanguageKnowledge but has a LanguageKnowledgeModifier!"); + return; + } + + foreach (var spokenLanguage in entity.Comp.NewSpokenLanguages) + { + _languages.AddLanguage(entity, spokenLanguage, true, false, knowledge); + } + + foreach (var understoodLanguage in entity.Comp.NewUnderstoodLanguages) + { + _languages.AddLanguage(entity, understoodLanguage, false, true, knowledge); + } + } +} diff --git a/Resources/Locale/en-US/language/languages.ftl b/Resources/Locale/en-US/language/languages.ftl index 14d477b7840..4b0c1248f28 100644 --- a/Resources/Locale/en-US/language/languages.ftl +++ b/Resources/Locale/en-US/language/languages.ftl @@ -28,6 +28,9 @@ language-Moffic-description = The language of the mothpeople borders on complete language-RobotTalk-name = RobotTalk language-RobotTalk-description = A language consisting of harsh binary chirps, whistles, hisses, and whines. Organic tongues cannot speak it without aid from special translators. +language-Sign-name = Galactic Sign Language +language-Sign-description = GSL for short, this sign language is prevalent among mute and deaf people. + language-Cat-name = Cat language-Cat-description = Meow @@ -72,6 +75,3 @@ language-Kobold-description = Hiss! language-Hissing-name = Hissing language-Hissing-description = Hiss! - -language-Sign-name = Sign Language -language-Sign-description = The standard Galactic sign language, used by those that are unable to speak Galactic Common or at all. diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index e8d007542fa..600a9834fd4 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -56,6 +56,11 @@ trait-description-Foreigner = For one reason or another you do not speak this station's primary language. Instead, you have a translator issued to you that only you can use. +trait-name-SignLanguage = Sign Language +trait-description-SignLanguage = + You can understand and use Galactic Sign Language (GSL). + If you are mute for any reason, you can still communicate with sign language. + trait-name-Voracious = Voracious trait-description-Voracious = Nothing gets between you and your food. diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index 51eeadfcada..16b628a56d8 100644 --- a/Resources/Prototypes/Traits/skills.yml +++ b/Resources/Prototypes/Traits/skills.yml @@ -32,6 +32,17 @@ species: - Felinid +- type: trait + id: SignLanguage + category: Visual + points: -1 + components: + - type: LanguageKnowledgeModifier + speaks: + - Sign + understands: + - Sign + - type: trait id: Voracious category: Physical