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