mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* init * make it proper * listing, random humanoid appearance to shared * oops * moar * pre-pr cleanup * examine change * partial review * ye * comment * examinable * sounds * TrapInContainer >>>>> * textures * ambience * fix * Change collection to use leftclicking * last minute balance change fuck everything --------- Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Content.Shared.Body;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.Preferences;
|
|
|
|
namespace Content.Server.Humanoid.Systems;
|
|
|
|
public sealed partial class RandomHumanoidAppearanceSystem : EntitySystem
|
|
{
|
|
[Dependency] private HumanoidProfileSystem _humanoidProfile = default!;
|
|
[Dependency] private MetaDataSystem _metaData = default!;
|
|
[Dependency] private 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);
|
|
|
|
_visualBody.ApplyProfileTo(uid, profile);
|
|
_humanoidProfile.ApplyProfileTo(uid, profile);
|
|
|
|
if (component.RandomizeName)
|
|
_metaData.SetEntityName(uid, profile.Name);
|
|
}
|
|
}
|