Files
tbd-station-14/Content.Client/UserInterface/HumanoidProfileEditor.Random.cs
DrSmugleaf 902aa128c2 Enable nullability in Content.Client (#3257)
* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
2021-03-10 14:48:29 +01:00

36 lines
1.1 KiB
C#

using Content.Shared.Preferences;
using Content.Shared.Prototypes;
using Content.Shared.Utility;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Client.UserInterface
{
public partial class HumanoidProfileEditor
{
private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototypeManager;
private void RandomizeEverything()
{
Profile = HumanoidCharacterProfile.Random();
UpdateSexControls();
UpdateGenderControls();
UpdateClothingControls();
UpdateAgeEdit();
UpdateNameEdit();
UpdateHairPickers();
UpdateEyePickers();
}
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();
}
}
}