mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description This significantly improves the quality of the language system by fixing the mistakes I've made almost a year ago while developing it. Mainly, this throws away the old half-broken way of networking in favor of the component state system provided by RT. Language speaker comp is now shared with SendOnlyToOwner = true, and its state is handled manually. In addition to that, this brings the following changes: - UniversalLanguageSpeaker and LanguageKnowledge are now server-side - DetermineLanguagesEvent and LanguagesUpdateEvent are now shared (so that future systems can be built in shared, if needed) - Everything now uses the ProtoId<LanguagePrototype> type instead of raw strings (god, I hated those so much) - The server-side language system now accepts Entity<T?> arguments instead of EntityUid + T - UniversalLanguageSpeaker is now based on DetermineEntityLanguagesEvent and gets an Enabled field, which allows to turn it off. This may have some use in the future. - Some minor cleanup <!-- TODO MEDIA <details><summary><h1>Media</h1></summary> <p>  </p> </details> --> # Changelog No cl --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com>
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
|
|
|
namespace Content.Shared.Language.Components.Translators;
|
|
|
|
public abstract partial class BaseTranslatorComponent : Component
|
|
{
|
|
/// <summary>
|
|
/// The list of additional languages this translator allows the wielder to speak.
|
|
/// </summary>
|
|
[DataField("spoken")]
|
|
public List<ProtoId<LanguagePrototype>> SpokenLanguages = new();
|
|
|
|
/// <summary>
|
|
/// The list of additional languages this translator allows the wielder to understand.
|
|
/// </summary>
|
|
[DataField("understood")]
|
|
public List<ProtoId<LanguagePrototype>> UnderstoodLanguages = new();
|
|
|
|
/// <summary>
|
|
/// The languages the wielding MUST know in order for this translator to have effect.
|
|
/// The field [RequiresAllLanguages] indicates whether all of them are required, or just one.
|
|
/// </summary>
|
|
[DataField("requires")]
|
|
public List<ProtoId<LanguagePrototype>> RequiredLanguages = new();
|
|
|
|
/// <summary>
|
|
/// If true, the wielder must understand all languages in [RequiredLanguages] to speak [SpokenLanguages],
|
|
/// and understand all languages in [RequiredLanguages] to understand [UnderstoodLanguages].
|
|
///
|
|
/// Otherwise, at least one language must be known (or the list must be empty).
|
|
/// </summary>
|
|
[DataField("requiresAll")]
|
|
public bool RequiresAllLanguages = false;
|
|
|
|
[DataField("enabled")]
|
|
public bool Enabled = true;
|
|
}
|