mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-21 15:38:52 +03:00
# 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>  </p></details> # Changelog 🆑 - fix: Foreigner traits now work correctly.
39 lines
1.3 KiB
C#
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!;
|
|
}
|