Files
Delta-v/Content.Server/Humanoid/Systems/RandomHumanoidAppearanceSystem.cs
T
pathetic meowmeow c57721eca5 Visual nubody (humanoid appearance refactor) (#42476)
* initial visual nubody

* oops overlay

* im so pheeming rn

* conversion...

* tests

* comeback of the underwear

* oops eyes

* blabbl

* zeds

* yaml linted

* search and visible count constraints

* reordering

* preserve previously selected markings colors

* fix test

* some ui niceties

* ordering

* make DB changes backwards-compatible/downgrade-friendly

* fix things again

* fix migration

* vulpkanin markings limit increase

* wrapping

* code cleanup and more code cleanup and more code cleanup and more code cleanup and

* fix slop ports

* better sampling API

* make filter work + use the method i made for its intended purpose

* fix test fails real quick

* magic mirror cleanup, remove TODO

* don't 0-init the organ profile data

* remove deltastates

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>

# Conflicts:
#	Content.Server/Humanoid/Components/RandomHumanoidAppearanceComponent.cs
#	Content.Server/Humanoid/Systems/RandomHumanoidAppearanceSystem.cs

# Conflicts:
#	Resources/Prototypes/Species/diona.yml

# Conflicts:
#	Content.Server/Zombies/ZombieSystem.Transform.cs
2026-06-29 12:43:35 +02:00

44 lines
1.4 KiB
C#

using Content.Server.Humanoid.Components;
using Content.Shared.Body;
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
namespace Content.Server.Humanoid.Systems;
public sealed class RandomHumanoidAppearanceSystem : EntitySystem
{
[Dependency] private readonly HumanoidProfileSystem _humanoidProfile = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedVisualBodySystem _visualBody = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RandomHumanoidAppearanceComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(EntityUid uid, RandomHumanoidAppearanceComponent component, MapInitEvent args)
{
// If we have an initial profile/base layer set, do not randomize this humanoid.
if (!TryComp<HumanoidProfileComponent>(uid, out var humanoid))
return;
var profile = HumanoidCharacterProfile.RandomWithSpecies(humanoid.Species);
// DeltaV - begin keep gender
if (component.KeepGender)
{
profile = profile.WithSex(humanoid.Sex);
profile = profile.WithGender(humanoid.Gender);
}
// DeltaV - end keep gender
_visualBody.ApplyProfileTo(uid, profile);
_humanoidProfile.ApplyProfileTo(uid, profile);
if (component.RandomizeName)
_metaData.SetEntityName(uid, profile.Name);
}
}