Change character names to use datasets prototypes (#3259)
* Remove old name lists in .txts * Fix tests * LATEST MASTER TECHNOLOGY
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Text;
|
||||
using Content.Shared.Prototypes;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
@@ -7,6 +9,7 @@ namespace Content.Client.UserInterface
|
||||
public partial class HumanoidProfileEditor
|
||||
{
|
||||
private readonly IRobustRandom _random;
|
||||
private readonly IPrototypeManager _prototypeManager;
|
||||
|
||||
private void RandomizeEverything()
|
||||
{
|
||||
@@ -21,10 +24,8 @@ namespace Content.Client.UserInterface
|
||||
|
||||
private void RandomizeName()
|
||||
{
|
||||
var firstName = _random.Pick(Profile.Sex == Sex.Male
|
||||
? Names.MaleFirstNames
|
||||
: Names.FemaleFirstNames);
|
||||
var lastName = _random.Pick(Names.LastNames);
|
||||
var firstName = _random.Pick(Profile.Sex.FirstNames(_prototypeManager).Values);
|
||||
var lastName = _random.Pick(_prototypeManager.Index<DatasetPrototype>("names_last"));
|
||||
SetName($"{firstName} {lastName}");
|
||||
UpdateNameEdit();
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components;
|
||||
using Content.Client.GameObjects.Components.Mobs;
|
||||
using Content.Client.Interfaces;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Localization.Macros;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Localization.Macros;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
{
|
||||
@@ -66,6 +66,7 @@ namespace Content.Client.UserInterface
|
||||
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IEntityManager entityManager)
|
||||
{
|
||||
_random = IoCManager.Resolve<IRobustRandom>();
|
||||
_prototypeManager = prototypeManager;
|
||||
|
||||
_preferencesManager = preferencesManager;
|
||||
|
||||
@@ -128,7 +129,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
Text = Loc.GetString("Randomize"),
|
||||
};
|
||||
nameRandomButton.OnPressed += args => RandomizeName();
|
||||
nameRandomButton.OnPressed += _ => RandomizeName();
|
||||
hBox.AddChild(nameLabel);
|
||||
hBox.AddChild(_nameEdit);
|
||||
hBox.AddChild(nameRandomButton);
|
||||
|
||||
Reference in New Issue
Block a user