Skip to content

Commit

Permalink
Unique Glove Fibers (#642)
Browse files Browse the repository at this point in the history
# Description

Cherry-picked from Delta-V, originally by @WarMechanic
(DeltaV-Station/Delta-v#1455).

Original Description:

> Every pair of gloves now has its own fingerprint, so items can be
traced back to gloves which can then be traced back to people.
> 
> ## Why / Balance
> 
> Evidence is very important to court cases running smoothly, so
detectives now have more evidence that can certify whether or not John
Syndicate's behaviour is valid. Traitors are now encouraged to either
clean evidence off syndicate gear regardless of glove status, or use a
disposable pair of gloves specifically for handling syndicate gear to be
disposed of later.
> 
> Aside from being required to obfuscate evidence you leave behind,
there is now a value proposition to searching glove prints of
departments. Wearing gloves that does not correspond your department can
punish an unknowing detective into searching the wrong people.
> 
> ## Technical details
> 
> `FiberComponent.cs` now stores a Fiberprint variable like
`FingerprintComponent.cs`. The code for assigning a fiberprint is the
same as the fingerprint. When evidence is placed on an object, the
fiberprint is concatenated to its localised fiber type.

<details><summary><h1>Original Media</h1></summary>
<p>

> hm ok we have these specific gloves on an akms
> <br>
> 
> <img
src="https://private-user-images.githubusercontent.com/69510347/345294367-55819ed3-1e89-401f-b7fb-0d8569bd7aa2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NjU2ODYsIm5iZiI6MTcyMjU2NTM4NiwicGF0aCI6Ii82OTUxMDM0Ny8zNDUyOTQzNjctNTU4MTllZDMtMWU4OS00MDFmLWI3ZmItMGQ4NTY5YmQ3YWEyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDAyMjMwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYxZWUxMjZjY2FiMTU1ODdlOGFiNDliN2ZjZjg4MmYxZmY3ZWY0MGMzN2UxZWM1MjA2MjBlYjY1ZDQ2YTJjMGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.t5sASM_0is4bqd1YIizQ0lldAZ5RAStbNzXNuzHmdfU">
> 
> hm well we found the gloves and they have fingerprints
> <br>
> 
> <img
src="https://private-user-images.githubusercontent.com/69510347/345294443-a9b21171-bee5-4c5f-8ec6-cf5576572d45.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NjU2ODYsIm5iZiI6MTcyMjU2NTM4NiwicGF0aCI6Ii82OTUxMDM0Ny8zNDUyOTQ0NDMtYTliMjExNzEtYmVlNS00YzVmLThlYzYtY2Y1NTc2NTcyZDQ1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDAyMjMwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3ZTY3NjRhZmEzMjRhYTkwNjUyOWI3MzgzOGM0ZWRjY2Q3MTg0YzViN2NjMDQyZTgzMDBiMmZlZDAyYWJjYjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.uSn27Drf1K8rcfQtYRo_fGKudbO03fp40GNHUSd4Uw0">
> 
> gotem
> <br>
> 
> <img
src="https://private-user-images.githubusercontent.com/69510347/345294064-d6254f48-2d81-4702-ac03-c1c796712ef4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NjU2ODYsIm5iZiI6MTcyMjU2NTM4NiwicGF0aCI6Ii82OTUxMDM0Ny8zNDUyOTQwNjQtZDYyNTRmNDgtMmQ4MS00NzAyLWFjMDMtYzFjNzk2NzEyZWY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDAyMjMwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgzNWYzODBmOWVhYzQzMjMxNDdlMzk5Zjk2ODY4N2I1ZWNmYmNkNGI2NGFlMjZiMDM1NGVjNDJlOGFjNjViN2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.TjsSLQpLoGsXOHS-wl_LSASdLxgeVTKxCGugkX7-v90">

</details>
</p>

# Changelog

:cl: WarMechanic
- add: Gloves now have unique fingerprints. Items can be traced back to
gloves, which can then be traced back to people.

---------

Signed-off-by: Angelo Fallaria <[email protected]>
Co-authored-by: WarMechanic <[email protected]>
Co-authored-by: deltanedas <[email protected]>
Co-authored-by: Danger Revolution! <[email protected]>
Co-authored-by: VMSolidus <[email protected]>
  • Loading branch information
5 people committed Aug 6, 2024
1 parent 5779039 commit 8768df7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Content.Server/Forensics/Components/FiberComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ public sealed partial class FiberComponent : Component

[DataField]
public string? FiberColor;

[DataField]
public string? Fiberprint;
}
}
17 changes: 14 additions & 3 deletions Content.Server/Forensics/Systems/ForensicsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed class ForensicsSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract);
SubscribeLocalEvent<FiberComponent, MapInitEvent>(OnFiberInit);
SubscribeLocalEvent<FingerprintComponent, MapInitEvent>(OnFingerprintInit);
SubscribeLocalEvent<DnaComponent, MapInitEvent>(OnDNAInit);

Expand All @@ -39,6 +40,11 @@ private void OnInteract(EntityUid uid, FingerprintComponent component, ContactIn
ApplyEvidence(uid, args.Other);
}

private void OnFiberInit(EntityUid uid, FiberComponent component, MapInitEvent args)
{
component.Fiberprint = GenerateFingerprint(length: 7);
}

private void OnFingerprintInit(EntityUid uid, FingerprintComponent component, MapInitEvent args)
{
component.Fingerprint = GenerateFingerprint();
Expand Down Expand Up @@ -150,9 +156,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)
{
var fingerprint = new byte[16];
var fingerprint = new byte[Math.Clamp(length, 0, 255)];
_random.NextBytes(fingerprint);
return Convert.ToHexString(fingerprint);
}
Expand All @@ -179,7 +185,12 @@ private void ApplyEvidence(EntityUid user, EntityUid target)
if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves))
{
if (TryComp<FiberComponent>(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);
}

if (HasComp<FingerprintMaskComponent>(gloves))
return;
Expand Down

0 comments on commit 8768df7

Please sign in to comment.