Files
OldThink/Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs

39 lines
1.2 KiB
C#
Raw Normal View History

2021-06-09 22:19:39 +02:00
using Content.Shared.CharacterAppearance;
using Content.Shared.Dataset;
using Content.Shared.Preferences;
2021-06-09 22:19:39 +02:00
using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
2021-06-09 22:19:39 +02:00
namespace Content.Client.Preferences.UI
{
public sealed partial class HumanoidProfileEditor
{
private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototypeManager;
private void RandomizeEverything()
{
2020-10-11 13:15:09 +02:00
Profile = HumanoidCharacterProfile.Random();
UpdateSexControls();
UpdateGenderControls();
UpdateClothingControls();
UpdateAgeEdit();
2020-10-11 13:15:09 +02:00
UpdateNameEdit();
UpdateHairPickers();
UpdateEyePickers();
_skinColor.Value = _random.Next(0, 100);
}
private void RandomizeName()
{
if (Profile == null) return;
var firstName = _random.Pick(Profile.Sex.FirstNames(_prototypeManager).Values);
var lastName = _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_last"));
SetName($"{firstName} {lastName}");
UpdateNameEdit();
}
}
}