Files
wwdpublic/Content.Server/_Shitmed/StatusEffects/ScrambleDnaEffectSystem.cs
Zachary Higgs 3264319e53 Move DnaComponent to shared (#35012)
* Move DnaComponent to shared

- Add Using statements to AdminSystem and StationRecordsSystem to point
to Content.Shared.Forensics

* Proper namespacing

* Revert an un-intended change

* Add Networking to DNA Component

* CR - Remove ("dna")

* CR - add back ("dna") tag

(cherry picked from commit 1c8e7443ae7f3a14c32f78709e75e04d9d304eed)
2025-09-20 20:35:09 +03:00

47 lines
1.8 KiB
C#

using Content.Server.Forensics;
using Content.Server.Humanoid;
using Content.Shared._Shitmed.StatusEffects;
using Content.Shared.Forensics;
using Content.Shared.Forensics.Components;
using Content.Shared.Humanoid;
using Content.Shared.Preferences;
using Content.Shared.Popups;
namespace Content.Server._Shitmed.StatusEffects;
public sealed class ScrambleDnaEffectSystem : EntitySystem
{
[Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!;
[Dependency] private readonly ForensicsSystem _forensicsSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
public override void Initialize()
{
SubscribeLocalEvent<ScrambleDnaEffectComponent, ComponentInit>(OnInit);
}
private void OnInit(EntityUid uid, ScrambleDnaEffectComponent component, ComponentInit args)
{
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
{
var newProfile = HumanoidCharacterProfile.RandomWithSpecies(humanoid.Species);
_humanoidAppearance.LoadProfile(uid, newProfile, humanoid, loadExtensions: false, generateLoadouts: false);
_metaData.SetEntityName(uid, newProfile.Name);
if (TryComp<DnaComponent>(uid, out var dna))
{
dna.DNA = _forensicsSystem.GenerateDNA();
var ev = new GenerateDnaEvent { Owner = uid, DNA = dna.DNA };
RaiseLocalEvent(uid, ref ev);
}
if (TryComp<FingerprintComponent>(uid, out var fingerprint))
{
fingerprint.Fingerprint = _forensicsSystem.GenerateFingerprint();
}
_popup.PopupEntity(Loc.GetString("scramble-implant-activated-popup"), uid, uid);
}
}
}