Cleanup forensic cleaning (#22715)

* Cleanup forensic cleaning

* move cleandelay to new component; buff syndiesoap

* updated based on feedback

* remove tag
This commit is contained in:
themias
2023-12-21 03:54:52 -05:00
committed by GitHub
parent 2f210df181
commit 59c8f23857
9 changed files with 44 additions and 22 deletions

View File

@@ -0,0 +1,14 @@
namespace Content.Server.Forensics;
/// <summary>
/// This component is for items that can clean up forensic evidence
/// </summary>
[RegisterComponent]
public sealed partial class CleansForensicsComponent : Component
{
/// <summary>
/// How long it takes to wipe prints/blood/etc. off of things using this entity
/// </summary>
[DataField]
public float CleanDelay = 12.0f;
}

View File

@@ -15,12 +15,6 @@ namespace Content.Server.Forensics
[DataField("residues")] [DataField("residues")]
public HashSet<string> Residues = new(); public HashSet<string> Residues = new();
/// <summary>
/// How long it takes to wipe the prints/blood/etc. off of this entity
/// </summary>
[DataField("cleanDelay")]
public float CleanDelay = 12.0f;
/// <summary> /// <summary>
/// How close you must be to wipe the prints/blood/etc. off of this entity /// How close you must be to wipe the prints/blood/etc. off of this entity
/// </summary> /// </summary>
@@ -29,7 +23,7 @@ namespace Content.Server.Forensics
/// <summary> /// <summary>
/// Can the DNA be cleaned off of this entity? /// Can the DNA be cleaned off of this entity?
/// e.g. you can clean the DNA off of a knife, but not a puddle /// e.g. you can wipe the DNA off of a knife, but not a cigarette
/// </summary> /// </summary>
[DataField("canDnaBeCleaned")] [DataField("canDnaBeCleaned")]
public bool CanDnaBeCleaned = true; public bool CanDnaBeCleaned = true;

View File

@@ -0,0 +1,7 @@
namespace Content.Server.Forensics.Components;
/// <summary>
/// This component is for entities we do not wish to track fingerprints/fibers, like puddles
/// </summary>
[RegisterComponent]
public sealed partial class IgnoresFingerprintsComponent : Component { }

View File

@@ -1,12 +1,13 @@
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.DoAfter; using Content.Server.DoAfter;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Forensics.Components;
using Content.Server.Popups;
using Content.Shared.DoAfter; using Content.Shared.DoAfter;
using Content.Shared.Forensics; using Content.Shared.Forensics;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Inventory; using Content.Shared.Inventory;
using Content.Shared.Tag;
using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Random; using Robust.Shared.Random;
@@ -16,8 +17,8 @@ namespace Content.Server.Forensics
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly InventorySystem _inventory = default!; [Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
public override void Initialize() public override void Initialize()
{ {
SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract); SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract);
@@ -26,7 +27,7 @@ namespace Content.Server.Forensics
SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed); SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit); SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ForensicsComponent, AfterInteractEvent>(OnAfterInteract); SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter); SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
SubscribeLocalEvent<DnaComponent, TransferDnaEvent>(OnTransferDnaEvent); SubscribeLocalEvent<DnaComponent, TransferDnaEvent>(OnTransferDnaEvent);
} }
@@ -70,15 +71,15 @@ namespace Content.Server.Forensics
} }
} }
private void OnAfterInteract(EntityUid uid, ForensicsComponent component, AfterInteractEvent args) private void OnAfterInteract(EntityUid uid, CleansForensicsComponent component, AfterInteractEvent args)
{ {
if (args.Handled) if (args.Handled)
return; return;
if (!_tagSystem.HasTag(args.Used, "CleansForensics")) if (!TryComp<ForensicsComponent>(args.Target, out var forensicsComp))
return; return;
if((component.DNAs.Count > 0 && component.CanDnaBeCleaned) || (component.Fingerprints.Count + component.Fibers.Count > 0)) if((forensicsComp.DNAs.Count > 0 && forensicsComp.CanDnaBeCleaned) || (forensicsComp.Fingerprints.Count + forensicsComp.Fibers.Count > 0))
{ {
var doAfterArgs = new DoAfterArgs(EntityManager, args.User, component.CleanDelay, new CleanForensicsDoAfterEvent(), uid, target: args.Target, used: args.Used) var doAfterArgs = new DoAfterArgs(EntityManager, args.User, component.CleanDelay, new CleanForensicsDoAfterEvent(), uid, target: args.Target, used: args.Used)
{ {
@@ -87,11 +88,11 @@ namespace Content.Server.Forensics
BreakOnDamage = true, BreakOnDamage = true,
BreakOnTargetMove = true, BreakOnTargetMove = true,
MovementThreshold = 0.01f, MovementThreshold = 0.01f,
DistanceThreshold = component.CleanDistance, DistanceThreshold = forensicsComp.CleanDistance,
}; };
_doAfterSystem.TryStartDoAfter(doAfterArgs); _doAfterSystem.TryStartDoAfter(doAfterArgs);
_popupSystem.PopupEntity(Loc.GetString("forensics-cleaning", ("target", args.Target)), args.User, args.User);
args.Handled = true; args.Handled = true;
} }
@@ -141,6 +142,9 @@ namespace Content.Server.Forensics
private void ApplyEvidence(EntityUid user, EntityUid target) private void ApplyEvidence(EntityUid user, EntityUid target)
{ {
if (HasComp<IgnoresFingerprintsComponent>(target))
return;
var component = EnsureComp<ForensicsComponent>(target); var component = EnsureComp<ForensicsComponent>(target);
if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves)) if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves))
{ {
@@ -175,6 +179,7 @@ namespace Content.Server.Forensics
{ {
EnsureComp<ForensicsComponent>(recipient, out var recipientComp); EnsureComp<ForensicsComponent>(recipient, out var recipientComp);
recipientComp.DNAs.Add(donorComp.DNA); recipientComp.DNAs.Add(donorComp.DNA);
recipientComp.CanDnaBeCleaned = canDnaBeCleaned;
} }
} }

View File

@@ -24,3 +24,5 @@ forensic-scanner-verb-message = Perform a forensic scan
forensic-pad-fingerprint-name = {$entity}'s fingerprints forensic-pad-fingerprint-name = {$entity}'s fingerprints
forensic-pad-gloves-name = fibers from {$entity} forensic-pad-gloves-name = fibers from {$entity}
forensics-cleaning = You begin cleaning the evidence off of {THE($target)}...

View File

@@ -162,3 +162,4 @@
- type: ExaminableSolution - type: ExaminableSolution
solution: puddle solution: puddle
- type: BadDrink - type: BadDrink
- type: IgnoresFingerprints

View File

@@ -611,6 +611,6 @@
tags: tags:
- DroneUsable - DroneUsable
- Mop - Mop
- CleansForensics - type: CleansForensics
- type: Fiber - type: Fiber
fiberColor: fibers-white fiberColor: fibers-white

View File

@@ -7,7 +7,6 @@
- type: Tag - type: Tag
tags: tags:
- Soap - Soap
- CleansForensics
- type: Sprite - type: Sprite
sprite: Objects/Specific/Janitorial/soap.rsi sprite: Objects/Specific/Janitorial/soap.rsi
layers: layers:
@@ -69,6 +68,7 @@
- type: Food - type: Food
solution: soap solution: soap
- type: BadFood - type: BadFood
- type: CleansForensics
- type: Residue - type: Residue
residueAdjective: residue-slippery residueAdjective: residue-slippery
residueColor: residue-green residueColor: residue-green
@@ -137,6 +137,8 @@
flavors: flavors:
- clean - clean
- punishment - punishment
- type: CleansForensics
cleanDelay: 8.0
- type: Residue - type: Residue
residueAdjective: residue-slippery residueAdjective: residue-slippery
residueColor: residue-red residueColor: residue-red

View File

@@ -1150,7 +1150,4 @@
id: MindShield id: MindShield
- type: Tag - type: Tag
id: boots id: boots
- type: Tag
id: CleansForensics