forked from DeltaV-Station/Delta-v
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Trait: Sign Language (DeltaV-Station#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 <[email protected]>
- Loading branch information
1 parent
27c2c35
commit 17aca3c
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Content.Server/Traits/Assorted/LanguageKnowledgeModifierComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
35
Content.Server/Traits/Assorted/LanguageKnowledgeModifierSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters