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.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<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;
}

for (var spokenLanguage in entity.Comp.NewSpokenLanguages)

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 25 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected
{
_languages.AddLanguage(entity, spokenLanguage, true, false, knowledge);
}

for (var understoodLanguage in entity.Comp.NewUnderstoodLanguages)

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / Test Packaging

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / YAML Linter

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected

Check failure on line 30 in Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Syntax error, 'foreach' expected
{
_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 @@ -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 Galactic Sign Language (GSL).
Being mute for any reason still allows you to communicate with sign language.
11 changes: 11 additions & 0 deletions Resources/Prototypes/Traits/skills.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading