Files
wwdpublic/Content.Shared/Humanoid/NamingSystem.cs
PHCodes 93c3b03b11 Psionics (#44)
* Psionics

It's a ton of stuff relating to the basic Psionics system and all the powers.

I'm saving this as a bit of a sanity check before moving forward.

Left to do:
1. Implementing the Psionic faction so that the chat works as intended.
2. Adding the start-state cooldown timers to the actions.

* Cleaned up everything with the word 'Psionic' on it.

Got the psionic chat working. Got some other stuff working

* Some final psionic cleanup.

The last batch of content.

* Update RobustToolbox

* rebased

* Revert "Update RobustToolbox"

This reverts commit c0cf35d03f828f6ccfeb05fcffd91cf074818fc9.

* Update RobustToolbox

* Revert "Update RobustToolbox"

This reverts commit c4dc828df7912e063ea856b2a83a790bc88d1e09.

* Update RobustToolbox

* Psionics

It's a ton of stuff relating to the basic Psionics system and all the powers.

I'm saving this as a bit of a sanity check before moving forward.

Left to do:
1. Implementing the Psionic faction so that the chat works as intended.
2. Adding the start-state cooldown timers to the actions.

* Cleaned up everything with the word 'Psionic' on it.

Got the psionic chat working. Got some other stuff working

* Some final psionic cleanup.

The last batch of content.

* rebased

* Cleaned up everything with the word 'Psionic' on it.

Got the psionic chat working. Got some other stuff working

* Broken Commit

With these changes in place, the unit does not work. Recording them so i don't lose my work.

* Brings it All Together.

Dawn of the final Commit. Rebase completed.

* Update RobustToolbox

* Changed 'Station Events' to 'StationEvents' and cleaned up the Delta-V Events.yml file of duplicate events.

* Delete ghost_roles.yml

Duplicate.

* Update familiars.yml

* Update familiars.yml

* Update GlimmerReactiveSystem.cs

* Makes tinfoil hats craftable.

* Decided I'm not dealing with adding fugitives or Glimmer Wisps right now.

* Psionic invisibility won't work now that Eye component exists. Or at least, the integrator test won't psas.

* Update special.yml

* Added #nyanotrasen code or //Nyanotrasen code to many, many files.

* Properly fixes comments.

---------

Signed-off-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
Signed-off-by: PHCodes <47927305+PHCodes@users.noreply.github.com>
Co-authored-by: Debug <sidneymaatman@gmail.com>
Co-authored-by: Colin-Tel <113523727+Colin-Tel@users.noreply.github.com>
2023-10-08 20:07:53 +02:00

69 lines
3.2 KiB
C#

using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Dataset;
using Robust.Shared.Random;
using Robust.Shared.Prototypes;
using Robust.Shared.Enums;
namespace Content.Shared.Humanoid
{
/// <summary>
/// Figure out how to name a humanoid with these extensions.
/// </summary>
public sealed class NamingSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public string GetName(string species, Gender? gender = null)
{
// if they have an old species or whatever just fall back to human I guess?
// Some downstream is probably gonna have this eventually but then they can deal with fallbacks.
if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesProto))
{
speciesProto = _prototypeManager.Index<SpeciesPrototype>("Human");
Log.Warning($"Unable to find species {species} for name, falling back to Human");
}
switch (speciesProto.Naming)
{
// Start of Nyano - Summary: for Oni naming
case SpeciesNaming.LastNoFirst:
return Loc.GetString("namepreset-lastnofirst",
("first", GetFirstName(speciesProto, gender)), ("last", GetLastName(speciesProto)));
// End of Nyano - Summary: for Oni naming
case SpeciesNaming.TheFirstofLast:
return Loc.GetString("namepreset-thefirstoflast",
("first", GetFirstName(speciesProto, gender)), ("last", GetLastName(speciesProto)));
case SpeciesNaming.FirstDashFirst:
return Loc.GetString("namepreset-firstdashfirst",
("first1", GetFirstName(speciesProto, gender)), ("first2", GetFirstName(speciesProto, gender)));
case SpeciesNaming.FirstLast:
default:
return Loc.GetString("namepreset-firstlast",
("first", GetFirstName(speciesProto, gender)), ("last", GetLastName(speciesProto)));
}
}
public string GetFirstName(SpeciesPrototype speciesProto, Gender? gender = null)
{
switch (gender)
{
case Gender.Male:
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.MaleFirstNames).Values);
case Gender.Female:
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.FemaleFirstNames).Values);
default:
if (_random.Prob(0.5f))
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.MaleFirstNames).Values);
else
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.FemaleFirstNames).Values);
}
}
public string GetLastName(SpeciesPrototype speciesProto)
{
return _random.Pick(_prototypeManager.Index<DatasetPrototype>(speciesProto.LastNames).Values);
}
}
}