Forensic fixes (#18681)
This commit is contained in:
@@ -11,8 +11,8 @@ namespace Content.Server.Forensics
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract);
|
||||
SubscribeLocalEvent<FingerprintComponent, ComponentInit>(OnFingeprintInit);
|
||||
SubscribeLocalEvent<DnaComponent, ComponentInit>(OnDNAInit);
|
||||
SubscribeLocalEvent<FingerprintComponent, MapInitEvent>(OnFingerprintInit);
|
||||
SubscribeLocalEvent<DnaComponent, MapInitEvent>(OnDNAInit);
|
||||
}
|
||||
|
||||
private void OnInteract(EntityUid uid, FingerprintComponent component, ContactInteractionEvent args)
|
||||
@@ -20,31 +20,31 @@ namespace Content.Server.Forensics
|
||||
ApplyEvidence(uid, args.Other);
|
||||
}
|
||||
|
||||
private void OnFingeprintInit(EntityUid uid, FingerprintComponent component, ComponentInit args)
|
||||
private void OnFingerprintInit(EntityUid uid, FingerprintComponent component, MapInitEvent args)
|
||||
{
|
||||
component.Fingerprint = GenerateFingerprint();
|
||||
}
|
||||
|
||||
private void OnDNAInit(EntityUid uid, DnaComponent component, ComponentInit args)
|
||||
private void OnDNAInit(EntityUid uid, DnaComponent component, MapInitEvent args)
|
||||
{
|
||||
component.DNA = GenerateDNA();
|
||||
}
|
||||
|
||||
private string GenerateFingerprint()
|
||||
{
|
||||
byte[] fingerprint = new byte[16];
|
||||
var fingerprint = new byte[16];
|
||||
_random.NextBytes(fingerprint);
|
||||
return Convert.ToHexString(fingerprint);
|
||||
}
|
||||
|
||||
private string GenerateDNA()
|
||||
{
|
||||
var letters = new List<string> { "A", "C", "G", "T" };
|
||||
string DNA = String.Empty;
|
||||
var letters = new[] { "A", "C", "G", "T" };
|
||||
var DNA = string.Empty;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
for (var i = 0; i < 16; i++)
|
||||
{
|
||||
DNA += letters[_random.Next(letters.Count)];
|
||||
DNA += letters[_random.Next(letters.Length)];
|
||||
}
|
||||
|
||||
return DNA;
|
||||
|
||||
Reference in New Issue
Block a user