Skip to content

Commit

Permalink
Unique glove fibers (#1455) (#1645)
Browse files Browse the repository at this point in the history
* Unique glove fibers (#1455)

* make changes

* comments

* commiting a single whitespace so i dont get executed

---------

Co-authored-by: deltanedas <[email protected]>

* Ungloves Your Gloves

* Fixup

---------

Co-authored-by: WarMechanic <[email protected]>
Co-authored-by: deltanedas <[email protected]>
  • Loading branch information
3 people authored Jul 10, 2024
1 parent 74efbc8 commit 9b001af
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 18 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; // DeltaV, unique glove fibers
}
}
21 changes: 18 additions & 3 deletions Content.Server/Forensics/Systems/ForensicsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public sealed class ForensicsSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract);
SubscribeLocalEvent<FiberComponent, MapInitEvent>(OnFiberInit); // DeltaV #1455 - unique glove fibers
SubscribeLocalEvent<FingerprintComponent, MapInitEvent>(OnFingerprintInit);
SubscribeLocalEvent<DnaComponent, MapInitEvent>(OnDNAInit);

Expand All @@ -44,6 +45,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();
Expand Down Expand Up @@ -203,9 +211,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);
}
Expand All @@ -231,8 +239,15 @@ private void ApplyEvidence(EntityUid user, EntityUid target)
var component = EnsureComp<ForensicsComponent>(target);
if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves))
{
// DeltaV #1455 - unique glove fibers
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);
}
// End of DeltaV code

if (HasComp<FingerprintMaskComponent>(gloves))
return;
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/forensics/fibers.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fibers-cream = cream
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
components:
- type: Fiber
fiberMaterial: fibers-synthetic
# - type: FingerprintMask # Frontier
- type: FingerprintMask
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Clothing/Hands/colored.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
name: insulated gloves
description: These gloves will protect the wearer from electric shocks.
components:
# - type: FingerprintMask # Frontier
- type: FingerprintMask
- type: Sprite
sprite: Clothing/Hands/Gloves/Color/yellow.rsi
- type: Clothing
Expand Down
24 changes: 12 additions & 12 deletions Resources/Prototypes/Entities/Clothing/Hands/gloves.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-red
# - type: FingerprintMask # Frontier
- type: FingerprintMask
- type: Tag
tags:
- Kangaroo
Expand All @@ -44,7 +44,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-blue
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsGlovesBoxingRed
Expand All @@ -60,7 +60,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-green
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsGlovesBoxingRed
Expand All @@ -76,7 +76,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-yellow
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsGlovesBoxingBlue
Expand Down Expand Up @@ -109,7 +109,7 @@
- type: Fiber
fiberMaterial: fibers-durathread
fiberColor: fibers-regal-blue
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsBase
Expand All @@ -128,7 +128,7 @@
modifiers:
coefficients:
Slash: 0.95
# - type: FingerprintMask # Frontier
- type: FingerprintMask

#### Medical
- type: entity
Expand All @@ -143,7 +143,7 @@
sprite: Clothing/Hands/Gloves/latex.rsi
- type: Fiber
fiberMaterial: fibers-latex
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsButcherable
Expand All @@ -157,7 +157,7 @@
sprite: Clothing/Hands/Gloves/nitrile.rsi
- type: Fiber
fiberMaterial: fibers-nitrile
# - type: FingerprintMask # Frontier
- type: FingerprintMask
####
- type: entity
parent: ClothingHandsButcherable
Expand All @@ -174,7 +174,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-brown
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsBase
Expand All @@ -188,7 +188,7 @@
sprite: Clothing/Hands/Gloves/powerglove.rsi
- type: Fiber
fiberMaterial: fibers-nanomachines
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsButcherable
Expand All @@ -203,7 +203,7 @@
- type: Fiber
fiberMaterial: fibers-leather
fiberColor: fibers-black
# - type: FingerprintMask # Frontier
- type: FingerprintMask

- type: entity
parent: ClothingHandsBase
Expand Down Expand Up @@ -426,4 +426,4 @@
- type: Fiber
fiberMaterial: fibers-rubber
fiberColor: fibers-yellow
# - type: FingerprintMask # Frontier
- type: FingerprintMask
10 changes: 9 additions & 1 deletion Resources/Prototypes/_NF/Entities/Clothing/Hands/gloves.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
sprite: _NF/Clothing/Hands/Gloves/arcadia.rsi
- type: Clothing
sprite: _NF/Clothing/Hands/Gloves/arcadia.rsi
- type: Fiber
fiberColor: fibers-white

- type: entity
parent: ClothingHandsGlovesLeather
Expand All @@ -19,6 +21,8 @@
sprite: _NF/Clothing/Hands/Gloves/pilot.rsi
- type: Clothing
sprite: _NF/Clothing/Hands/Gloves/pilot.rsi
- type: Fiber
fiberColor: fibers-brown

- type: entity
parent: ClothingHandsGlovesCombat
Expand All @@ -30,9 +34,11 @@
sprite: _NF/Clothing/Hands/Gloves/nfsd_brown.rsi
- type: Clothing
sprite: _NF/Clothing/Hands/Gloves/nfsd_brown.rsi
- type: Fiber
fiberColor: fibers-brown

- type: entity
parent: ClothingHandsGlovesCombat
parent: ClothingHandsGlovesCombatNfsdBrown
id: ClothingHandsGlovesCombatNfsdCream
name: nfsd combat gloves
description: Insulated gloves for a deputy sheriff.
Expand All @@ -41,6 +47,8 @@
sprite: _NF/Clothing/Hands/Gloves/nfsd_cream.rsi
- type: Clothing
sprite: _NF/Clothing/Hands/Gloves/nfsd_cream.rsi
- type: Fiber
fiberColor: fibers-cream

- type: entity
parent: ClothingHandsGlovesHop
Expand Down

0 comments on commit 9b001af

Please sign in to comment.