Files
Delta-v/Content.Shared/Humanoid/NamingSystem.cs
T
CorynandJanet Blackquill 1f8afb9ba6 Nubody (1/3) - Ipc removal (#5840)
* Reapply "Nubody Merge" (#5807)

This reverts commit d62f7cef10.

* Revert "Nubody Merge (#5670)"

This reverts commit b465cfb3fd.

* Revert "IPC fibers (#4968)"

This reverts commit c2b42211f0.

* Revert "IPC Polymorph fix (#4545)"

This reverts commit fa03d8c655.

* Revert "fix IPC not having humanoid emotes (#4445)"

This reverts commit 216fdf999f.

* Revert "ipc heat/cold (#4306)"

This reverts commit fafd5cf816.

* Revert "ipc cables (#4283)"

This reverts commit 54958039a1.

* Revert "feat: ipcs now have dynamic power draw based off movement speed (#3917)"

This reverts commit 71e8b7e64b.

* Revert "fix ipcs not being able to disarm (#3374)"

This reverts commit 764c4dcf54.

* Revert "make steel heal caustic for ipcs (#3206)"

This reverts commit 450ac82550.

* Revert "add missing ipc survival boxes (#3065)"

This reverts commit 888c9cdb00.

* Revert "make borgs use ipc repairing (#3064)"

This reverts commit f77a49dd0b.

* Revert "added ipc plushie (batteries not included) (#3023)"

This reverts commit 743cdbb606.

* Revert "Update hud.yml to add ipcs to diagnostic hud (#3019)"

This reverts commit 7220643531.

* Revert "Tweak IPCs (#2979)"

This reverts commit 98b47476de.

* Revert "fix nukies ipc test fail (#2957)"

This reverts commit 4a1acbf863.

* Revert "fix ipc nukies not getting comms (#2884)"

This reverts commit 8a2254770e.

* Revert "fix ipc encryption key mispredict (#2879)"

This reverts commit f08726efc1.

* remove oil

* Revert "Merge pull request #2800 from Spielern/port-ipc"

This reverts commit 822fa4312c, reversing
changes made to fe4c23c702.

* Remove and Fix rest of IPC Hangons causing crashes

* Integration test Errors

* Expand migration file with removed IPC stuff

* IPC Leg was found and migrated to naught

* motorkinds need to inherit an actual species base

* forgot the alerts

* irrelevant coscult code

* excess casualties

---------

Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
2026-05-19 18:53:01 -04:00

78 lines
3.6 KiB
C#

using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Dataset;
using Content.Shared.Random.Helpers;
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
{
private static readonly ProtoId<SpeciesPrototype> FallbackSpecies = "Human";
[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(FallbackSpecies);
Log.Warning($"Unable to find species {species} for name, falling back to {FallbackSpecies}");
}
switch (speciesProto.Naming)
{
case SpeciesNaming.First:
return Loc.GetString("namepreset-first",
("first", GetFirstName(speciesProto, gender)));
// 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.LastFirst: // DeltaV: Rodentia name scheme
return Loc.GetString("namepreset-lastfirst",
("last", GetLastName(speciesProto)), ("first", 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(speciesProto.MaleFirstNames));
case Gender.Female:
return _random.Pick(_prototypeManager.Index(speciesProto.FemaleFirstNames));
default:
if (_random.Prob(0.5f))
return _random.Pick(_prototypeManager.Index(speciesProto.MaleFirstNames));
else
return _random.Pick(_prototypeManager.Index(speciesProto.FemaleFirstNames));
}
}
public string GetLastName(SpeciesPrototype speciesProto)
{
return _random.Pick(_prototypeManager.Index(speciesProto.LastNames));
}
}
}