Files
wwdpublic/Content.Server/Traits/Assorted/ForeignerTraitComponent.cs
Mnemotechnican 98d39ca52c Foreigner Minor Fixes (#542)
# Description

#525 Added foreigner traits, now during testing I revealed a few bugs.
This PR fixes them:
- The light version now correctly allows you to understand common (it
would not because I forgot to add [DataField])
- The translator now correctly starts with a high-capacity power cell
- Equipping the translator in a pocket slot no longer takes time

<details><summary><h1>Media</h1></summary><p>


![image](https://github.com/user-attachments/assets/4d2cabc7-2ce2-498b-822b-8ff9b82eea7d)

</p></details>

# Changelog
🆑
- fix: Foreigner traits now work correctly.
2024-07-12 13:46:37 -04:00

39 lines
1.3 KiB
C#

using Content.Shared.Language;
using Content.Shared.Language.Systems;
using Robust.Shared.Prototypes;
namespace Content.Server.Traits.Assorted;
/// <summary>
/// When applied to a not-yet-spawned player entity, removes <see cref="BaseLanguage"/> from the lists of their languages
/// and gives them a translator instead.
/// </summary>
[RegisterComponent]
public sealed partial class ForeignerTraitComponent : Component
{
/// <summary>
/// The "base" language that is to be removed and substituted with a translator.
/// By default, equals to the fallback language, which is GalacticCommon.
/// </summary>
[DataField]
public ProtoId<LanguagePrototype> BaseLanguage = SharedLanguageSystem.FallbackLanguagePrototype;
/// <summary>
/// Whether this trait prevents the entity from understanding the base language.
/// </summary>
[DataField]
public bool CantUnderstand = true;
/// <summary>
/// Whether this trait prevents the entity from speaking the base language.
/// </summary>
[DataField]
public bool CantSpeak = true;
/// <summary>
/// The base translator prototype to use when creating a translator for the entity.
/// </summary>
[DataField(required: true)]
public ProtoId<EntityPrototype> BaseTranslator = default!;
}