Skip to content

Commit

Permalink
комментарии, да да
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Jan 19, 2025
1 parent 830163b commit 785aab6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Content.Client/Lobby/LobbyUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ private void OnProtoReload(PrototypesReloadedEventArgs obj)
{
_profileEditor.RefreshTraits();
}
// ADT Languages start
if (obj.WasModified<LanguagePrototype>())
{
_profileEditor.RefreshLanguages();
}
// ADT Languages end
}
}

Expand Down
10 changes: 6 additions & 4 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,14 @@ public HumanoidProfileEditor(

#endregion Appearance

// ADT Languages start
#region Languages
RefreshLanguages();
#endregion Languages
// ADT Languages end
#region Jobs

TabContainer.SetTabTitle(2, Loc.GetString("humanoid-profile-editor-jobs-tab"));
TabContainer.SetTabTitle(2, Loc.GetString("humanoid-profile-editor-jobs-tab")); // ADT Languages tweak

PreferenceUnavailableButton.AddItem(
Loc.GetString("humanoid-profile-editor-preference-unavailable-stay-in-lobby-button"),
Expand All @@ -475,13 +477,13 @@ public HumanoidProfileEditor(

#endregion Jobs

TabContainer.SetTabTitle(3, Loc.GetString("humanoid-profile-editor-antags-tab"));
TabContainer.SetTabTitle(3, Loc.GetString("humanoid-profile-editor-antags-tab")); // ADT Languages tweak

RefreshTraits();

#region Markings

TabContainer.SetTabTitle(5, Loc.GetString("humanoid-profile-editor-markings-tab"));
TabContainer.SetTabTitle(5, Loc.GetString("humanoid-profile-editor-markings-tab")); // ADT Languages tweak

Markings.OnMarkingAdded += OnMarkingChange;
Markings.OnMarkingRemoved += OnMarkingChange;
Expand Down Expand Up @@ -560,7 +562,7 @@ public void RefreshTraits()
TraitsList.DisposeAllChildren();

var traits = _prototypeManager.EnumeratePrototypes<TraitPrototype>().OrderBy(t => Loc.GetString(t.Name)).ToList();
TabContainer.SetTabTitle(4, Loc.GetString("humanoid-profile-editor-traits-tab"));
TabContainer.SetTabTitle(4, Loc.GetString("humanoid-profile-editor-traits-tab")); // ADT Languages tweak

if (traits.Count < 1)
{
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/EntityEffects/Effects/MakeSentient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ public override void Effect(EntityEffectBaseArgs args)
entityManager.RemoveComponent<ReplacementAccentComponent>(uid);
entityManager.RemoveComponent<MonkeyAccentComponent>(uid);

// Lang start
// ADT Languages start
var lang = entityManager.EnsureComponent<LanguageSpeakerComponent>(uid);
if (!lang.Languages.ContainsKey("GalacticCommon"))
lang.Languages.Add("GalacticCommon", LanguageKnowledge.Speak);
else
lang.Languages["GalacticCommon"] = LanguageKnowledge.Speak;
// Lang end
// ADT Languages end

// Stops from adding a ghost role to things like people who already have a mind
if (entityManager.TryGetComponent<MindContainerComponent>(uid, out var mindContainer) && mindContainer.HasMind)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Mind/Commands/MakeSentientCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public static void MakeSentient(EntityUid uid, IEntityManager entityManager, boo
entityManager.EnsureComponent<SpeechComponent>(uid);
entityManager.EnsureComponent<EmotingComponent>(uid);

// Lang start
// ADT Languages start
var lang = entityManager.EnsureComponent<LanguageSpeakerComponent>(uid);
if (!lang.Languages.ContainsKey("GalacticCommon"))
lang.Languages.Add("GalacticCommon", LanguageKnowledge.Speak);
else
lang.Languages["GalacticCommon"] = LanguageKnowledge.Speak;
// Lang end
// ADT Langusges end
}

entityManager.EnsureComponent<ExaminerComponent>(uid);
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public virtual void LoadProfile(EntityUid uid, HumanoidCharacterProfile? profile
EnsureDefaultMarkings(uid, humanoid);
SetTTSVoice(uid, profile.Voice, humanoid); // Corvax-TTS
SetBarkData(uid, profile.Bark, humanoid); // ADT Barks
SetLanguages(uid, profile.Languages.ToList());
SetLanguages(uid, profile.Languages.ToList()); // ADT Languages
humanoid.Gender = profile.Gender;
if (TryComp<GrammarComponent>(uid, out var grammar))
{
Expand Down
12 changes: 7 additions & 5 deletions Content.Shared/Preferences/HumanoidCharacterProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ public HumanoidCharacterProfile()
/// <returns>Humanoid character profile with default settings.</returns>
public static HumanoidCharacterProfile DefaultWithSpecies(string species = SharedHumanoidAppearanceSystem.DefaultSpecies)
{
var proto = IoCManager.Resolve<IPrototypeManager>();
var proto = IoCManager.Resolve<IPrototypeManager>(); // ADT Languages
return new()
{
Species = species,
_languages = proto.Index<SpeciesPrototype>(species).DefaultLanguages.ToHashSet()
_languages = proto.Index<SpeciesPrototype>(species).DefaultLanguages.ToHashSet() // ADT Languages
};
}

Expand All @@ -263,12 +263,12 @@ public static HumanoidCharacterProfile RandomWithSpecies(string species = Shared

var sex = Sex.Unsexed;
var age = 18;
HashSet<ProtoId<LanguagePrototype>> languages = new();
HashSet<ProtoId<LanguagePrototype>> languages = new(); // ADT Languages
if (prototypeManager.TryIndex<SpeciesPrototype>(species, out var speciesPrototype))
{
sex = random.Pick(speciesPrototype.Sexes);
age = random.Next(speciesPrototype.MinAge, speciesPrototype.OldAge); // people don't look and keep making 119 year old characters with zero rp, cap it at middle aged
languages = speciesPrototype.DefaultLanguages.ToHashSet();
languages = speciesPrototype.DefaultLanguages.ToHashSet(); // ADT Languages
}

// Corvax-TTS-Start
Expand Down Expand Up @@ -550,7 +550,7 @@ public bool MemberwiseEquals(ICharacterProfile maybeOther)
if (!_jobPriorities.SequenceEqual(other._jobPriorities)) return false;
if (!_antagPreferences.SequenceEqual(other._antagPreferences)) return false;
if (!_traitPreferences.SequenceEqual(other._traitPreferences)) return false;
if (!_languages.SequenceEqual(other._languages)) return false;
if (!_languages.SequenceEqual(other._languages)) return false; // ADT Languages
if (!Loadouts.SequenceEqual(other.Loadouts)) return false;
if (FlavorText != other.FlavorText) return false;
// ADT Barks start
Expand Down Expand Up @@ -737,6 +737,7 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection
_loadouts.Remove(value);
}

// ADT Languages start
if (_languages.Count <= 0)
_languages = new(speciesPrototype.DefaultLanguages);
List<ProtoId<LanguagePrototype>> langsInvalid = new();
Expand All @@ -749,6 +750,7 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection
{
_languages.Remove(lang);
}
// ADT Languages end
}

/// <summary>
Expand Down

0 comments on commit 785aab6

Please sign in to comment.