diff --git a/Content.Server/Forensics/Components/FiberComponent.cs b/Content.Server/Forensics/Components/FiberComponent.cs index 2086c958702..d2fc3a4bd90 100644 --- a/Content.Server/Forensics/Components/FiberComponent.cs +++ b/Content.Server/Forensics/Components/FiberComponent.cs @@ -12,5 +12,8 @@ public sealed partial class FiberComponent : Component [DataField] public string? FiberColor; + + [DataField] + public string? Fiberprint; // DeltaV, unique glove fibers } } diff --git a/Content.Server/Forensics/Systems/ForensicsSystem.cs b/Content.Server/Forensics/Systems/ForensicsSystem.cs index 3304330acab..285fe536f49 100644 --- a/Content.Server/Forensics/Systems/ForensicsSystem.cs +++ b/Content.Server/Forensics/Systems/ForensicsSystem.cs @@ -25,6 +25,7 @@ public sealed class ForensicsSystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(OnInteract); + SubscribeLocalEvent(OnFiberInit); // DeltaV #1455 - unique glove fibers SubscribeLocalEvent(OnFingerprintInit); SubscribeLocalEvent(OnDNAInit); @@ -43,6 +44,13 @@ private void OnInteract(EntityUid uid, FingerprintComponent component, ContactIn ApplyEvidence(uid, args.Other); } + // DeltaV #1455 - unique glove fibers + private void OnFiberInit(EntityUid uid, FiberComponent component, MapInitEvent args) + { + component.Fiberprint = GenerateFingerprint(length: 7); + } + // End of DeltaV code + private void OnFingerprintInit(EntityUid uid, FingerprintComponent component, MapInitEvent args) { component.Fingerprint = GenerateFingerprint(); @@ -202,9 +210,9 @@ private void OnCleanForensicsDoAfter(EntityUid uid, ForensicsComponent component targetComp.Residues.Add(string.IsNullOrEmpty(residue.ResidueColor) ? Loc.GetString("forensic-residue", ("adjective", residue.ResidueAdjective)) : Loc.GetString("forensic-residue-colored", ("color", residue.ResidueColor), ("adjective", residue.ResidueAdjective))); } - public string GenerateFingerprint() + public string GenerateFingerprint(int length = 16) // DeltaV #1455 - allow changing the length of the fingerprint hash { - var fingerprint = new byte[16]; + var fingerprint = new byte[length]; // DeltaV #1455 - allow changing the length of the fingerprint hash _random.NextBytes(fingerprint); return Convert.ToHexString(fingerprint); } @@ -230,8 +238,15 @@ private void ApplyEvidence(EntityUid user, EntityUid target) var component = EnsureComp(target); if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves)) { + // DeltaV #1455 - unique glove fibers if (TryComp(gloves, out var fiber) && !string.IsNullOrEmpty(fiber.FiberMaterial)) - component.Fibers.Add(string.IsNullOrEmpty(fiber.FiberColor) ? Loc.GetString("forensic-fibers", ("material", fiber.FiberMaterial)) : Loc.GetString("forensic-fibers-colored", ("color", fiber.FiberColor), ("material", fiber.FiberMaterial))); + { + var fiberLocale = string.IsNullOrEmpty(fiber.FiberColor) + ? Loc.GetString("forensic-fibers", ("material", fiber.FiberMaterial)) + : Loc.GetString("forensic-fibers-colored", ("color", fiber.FiberColor), ("material", fiber.FiberMaterial)); + component.Fibers.Add(fiberLocale + " ; " + fiber.Fiberprint); + } + // End of DeltaV code if (HasComp(gloves)) return;