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

New Trait: Sign Language #677

Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared.Language;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;

namespace Content.Server.Traits.Assorted;

/// <summary>
/// Used for traits that modify entities' language knowledge.
/// </summary>
[RegisterComponent]
public sealed partial class LanguageKnowledgeModifierComponent : Component
{
/// <summary>
/// List of languages this entity will learn to speak.
/// </summary>
[DataField("speaks")]
public List<string> NewSpokenLanguages = new();

/// <summary>
/// List of languages this entity will learn to understand.
/// </summary>
[DataField("understands")]
public List<string> NewUnderstoodLanguages = new();
}
35 changes: 35 additions & 0 deletions Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs
Original file line number Diff line number Diff line change
@@ -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<LanguageKnowledgeModifierComponent, ComponentInit>(OnStartup);
}

private void OnStartup(Entity<LanguageKnowledgeModifierComponent> entity, ref ComponentInit args)
{
if (!TryComp<LanguageKnowledgeComponent>(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);
}
}
}
6 changes: 3 additions & 3 deletions Resources/Locale/en-US/language/languages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
5 changes: 5 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading