2021-03-07 20:48:24 +01:00
|
|
|
using Content.Shared.Preferences;
|
2021-02-17 10:46:44 +01:00
|
|
|
using Content.Shared.Prototypes;
|
|
|
|
|
using Content.Shared.Utility;
|
|
|
|
|
using Robust.Shared.Prototypes;
|
2020-01-24 00:56:26 +01:00
|
|
|
using Robust.Shared.Random;
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public partial class HumanoidProfileEditor
|
|
|
|
|
{
|
|
|
|
|
private readonly IRobustRandom _random;
|
2021-02-17 10:46:44 +01:00
|
|
|
private readonly IPrototypeManager _prototypeManager;
|
2020-01-24 00:56:26 +01:00
|
|
|
|
|
|
|
|
private void RandomizeEverything()
|
|
|
|
|
{
|
2020-10-11 13:15:09 +02:00
|
|
|
Profile = HumanoidCharacterProfile.Random();
|
2020-01-24 00:56:26 +01:00
|
|
|
UpdateSexControls();
|
2020-12-24 13:42:40 +00:00
|
|
|
UpdateGenderControls();
|
|
|
|
|
UpdateClothingControls();
|
2020-01-24 00:56:26 +01:00
|
|
|
UpdateAgeEdit();
|
2020-10-11 13:15:09 +02:00
|
|
|
UpdateNameEdit();
|
|
|
|
|
UpdateHairPickers();
|
2021-03-07 20:48:24 +01:00
|
|
|
UpdateEyePickers();
|
2020-01-24 00:56:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RandomizeName()
|
|
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
if (Profile == null) return;
|
2021-02-17 10:46:44 +01:00
|
|
|
var firstName = _random.Pick(Profile.Sex.FirstNames(_prototypeManager).Values);
|
|
|
|
|
var lastName = _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_last"));
|
2020-01-24 00:56:26 +01:00
|
|
|
SetName($"{firstName} {lastName}");
|
|
|
|
|
UpdateNameEdit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|