From 11e25e5255f890faa9da5d1f91ace142ddde4d3f Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 22:31:31 +0800 Subject: [PATCH 1/8] feat(traits): add Sign Language trait --- .../LanguageKnowledgeModifierComponent.cs | 23 ++++++++++++ .../LanguageKnowledgeModifierSystem.cs | 35 +++++++++++++++++++ Resources/Locale/en-US/traits/traits.ftl | 5 +++ Resources/Prototypes/Traits/skills.yml | 11 ++++++ 4 files changed, 74 insertions(+) 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..e044b003530 --- /dev/null +++ b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs @@ -0,0 +1,35 @@ +using System.Linq; +using Content.Shared.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; + } + + for (var spokenLanguage in entity.Comp.NewSpokenLanguages) + { + _languages.AddLanguage(entity, spokenLanguage, true, false, knowledge); + } + + for (var understoodLanguage in entity.Comp.NewUnderstoodLanguages) + { + _languages.AddLanguage(entity, understoodLanguage, false, true, knowledge); + } + } +} diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 25c309476f0..03ac46abc77 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -60,3 +60,8 @@ trait-name-Voracious = Voracious trait-description-Voracious = Nothing gets between you and your food. Your endless consumption of food and drinks is twice as fast. + +trait-name-SignLanguage = Sign Language +trait-description-SignLanguage = + You can understand and use sign language, allowing for visual communication. + Being mute for any reason still allows you to communicate with sign language. diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index 6350cdc3c23..2587c8800fe 100644 --- a/Resources/Prototypes/Traits/skills.yml +++ b/Resources/Prototypes/Traits/skills.yml @@ -40,3 +40,14 @@ - type: ConsumeDelayModifier foodDelayMultiplier: 0.5 drinkDelayMultiplier: 0.5 + +- type: trait + id: SignLanguage + category: Visual + points: -1 + components: + - type: LanguageKnowledgeModifier + speaks: + - Sign + understands: + - Sign From 1c43b9062778bdd3165c7558b265e5282a7bae2f Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 22:56:18 +0800 Subject: [PATCH 2/8] tweak(language): rename Sign Language to Galactic Sign Language --- Resources/Locale/en-US/language/languages.ftl | 4 ++-- Resources/Locale/en-US/traits/traits.ftl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/Locale/en-US/language/languages.ftl b/Resources/Locale/en-US/language/languages.ftl index 14d477b7840..b7613cf096b 100644 --- a/Resources/Locale/en-US/language/languages.ftl +++ b/Resources/Locale/en-US/language/languages.ftl @@ -73,5 +73,5 @@ 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. +language-Sign-name = Galactic Sign Language +language-Sign-description = GSL for short, this sign language is prevalent among mute and deaf people. diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 03ac46abc77..b4a297b7cb2 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -63,5 +63,5 @@ trait-description-Voracious = trait-name-SignLanguage = Sign Language trait-description-SignLanguage = - You can understand and use sign language, allowing for visual communication. + You can understand and use Galactic Sign Language (GSL). Being mute for any reason still allows you to communicate with sign language. From 7b29425b46050e1613596f3f2b2851b840f9df1e Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 22:57:33 +0800 Subject: [PATCH 3/8] refactor(languages): relocate locale strings for sign language --- Resources/Locale/en-US/language/languages.ftl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/Locale/en-US/language/languages.ftl b/Resources/Locale/en-US/language/languages.ftl index b7613cf096b..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 = Galactic Sign Language -language-Sign-description = GSL for short, this sign language is prevalent among mute and deaf people. From 438bf3498069667003de1330e47f9cb023c67cb6 Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 23:16:21 +0800 Subject: [PATCH 4/8] fix(traits): replace `for` with `foreach` --- .../Traits/Assorted/LanguageKnowledgeModifierSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs index e044b003530..5c48556a067 100644 --- a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs +++ b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs @@ -22,12 +22,12 @@ private void OnStartup(Entity entity, ref Co return; } - for (var spokenLanguage in entity.Comp.NewSpokenLanguages) + foreach (var spokenLanguage in entity.Comp.NewSpokenLanguages) { _languages.AddLanguage(entity, spokenLanguage, true, false, knowledge); } - for (var understoodLanguage in entity.Comp.NewUnderstoodLanguages) + foreach (var understoodLanguage in entity.Comp.NewUnderstoodLanguages) { _languages.AddLanguage(entity, understoodLanguage, false, true, knowledge); } From d79de30a9655e85e6616dc306dd820e8fff1283f Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 23:22:57 +0800 Subject: [PATCH 5/8] fix(traits): use correct import --- .../Traits/Assorted/LanguageKnowledgeModifierSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs index 5c48556a067..9053c9404fe 100644 --- a/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs +++ b/Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs @@ -1,5 +1,5 @@ using System.Linq; -using Content.Shared.Language; +using Content.Server.Language; using Content.Shared.Language.Components; namespace Content.Server.Traits.Assorted; From 96a4262582a28a1bcfbec8651911584ab8fb375a Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 23:24:43 +0800 Subject: [PATCH 6/8] tweak(traits): reword description for Sign Language trait --- Resources/Locale/en-US/traits/traits.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index fd54152eb44..8dd50352a04 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -64,4 +64,4 @@ trait-description-Voracious = trait-name-SignLanguage = Sign Language trait-description-SignLanguage = You can understand and use Galactic Sign Language (GSL). - Being mute for any reason still allows you to communicate with sign language. + If you are mute for any reason, you can still communicate with sign language. From 728a1cb3df7009a8b6044473ce87f9bb19f94fc4 Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 23:37:18 +0800 Subject: [PATCH 7/8] fix(traits): remove duplicate LightStep entry Signed-off-by: Angelo Fallaria --- Resources/Prototypes/Traits/skills.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index 5daaf03d135..5a7fd17ead8 100644 --- a/Resources/Prototypes/Traits/skills.yml +++ b/Resources/Prototypes/Traits/skills.yml @@ -55,20 +55,6 @@ species: - Felinid -- type: trait - id: LightStep - category: Auditory - points: -1 - components: - - type: FootstepVolumeModifier - sprintVolumeModifier: -10 - walkVolumeModifier: -10 - requirements: - - !type:CharacterSpeciesRequirement - inverted: true - species: - - Felinid - - type: trait id: SignLanguage category: Visual @@ -78,4 +64,4 @@ speaks: - Sign understands: - - Sign \ No newline at end of file + - Sign From aa0a643044c7ee394507a284393a31d164db5984 Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Mon, 5 Aug 2024 23:42:03 +0800 Subject: [PATCH 8/8] refactor(traits): move YML entries of Sign Language mainly to prevent merge conflicts if #670 or #676 gets merged first --- Resources/Locale/en-US/traits/traits.ftl | 10 +++++----- Resources/Prototypes/Traits/skills.yml | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 7f7c68ea05e..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. @@ -64,8 +69,3 @@ trait-description-Voracious = trait-name-LightStep = Light Step trait-description-LightStep = You move with a gentle step, making your footsteps quieter. - -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. \ No newline at end of file diff --git a/Resources/Prototypes/Traits/skills.yml b/Resources/Prototypes/Traits/skills.yml index 5a7fd17ead8..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 @@ -54,14 +65,3 @@ inverted: true species: - Felinid - -- type: trait - id: SignLanguage - category: Visual - points: -1 - components: - - type: LanguageKnowledgeModifier - speaks: - - Sign - understands: - - Sign