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:
@@ -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;
|
||||
}
|
||||
@@ -15,12 +15,6 @@ namespace Content.Server.Forensics
|
||||
[DataField("residues")]
|
||||
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>
|
||||
/// How close you must be to wipe the prints/blood/etc. off of this entity
|
||||
/// </summary>
|
||||
@@ -29,7 +23,7 @@ namespace Content.Server.Forensics
|
||||
|
||||
/// <summary>
|
||||
/// 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>
|
||||
[DataField("canDnaBeCleaned")]
|
||||
public bool CanDnaBeCleaned = true;
|
||||
|
||||
@@ -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 { }
|
||||
@@ -1,12 +1,13 @@
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
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.Forensics;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -16,8 +17,8 @@ namespace Content.Server.Forensics
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<FingerprintComponent, ContactInteractionEvent>(OnInteract);
|
||||
@@ -26,7 +27,7 @@ namespace Content.Server.Forensics
|
||||
|
||||
SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
|
||||
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
SubscribeLocalEvent<ForensicsComponent, AfterInteractEvent>(OnAfterInteract);
|
||||
SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
|
||||
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
|
||||
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)
|
||||
return;
|
||||
|
||||
if (!_tagSystem.HasTag(args.Used, "CleansForensics"))
|
||||
if (!TryComp<ForensicsComponent>(args.Target, out var forensicsComp))
|
||||
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)
|
||||
{
|
||||
@@ -87,11 +88,11 @@ namespace Content.Server.Forensics
|
||||
BreakOnDamage = true,
|
||||
BreakOnTargetMove = true,
|
||||
MovementThreshold = 0.01f,
|
||||
DistanceThreshold = component.CleanDistance,
|
||||
DistanceThreshold = forensicsComp.CleanDistance,
|
||||
};
|
||||
|
||||
|
||||
_doAfterSystem.TryStartDoAfter(doAfterArgs);
|
||||
_popupSystem.PopupEntity(Loc.GetString("forensics-cleaning", ("target", args.Target)), args.User, args.User);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
@@ -141,6 +142,9 @@ namespace Content.Server.Forensics
|
||||
|
||||
private void ApplyEvidence(EntityUid user, EntityUid target)
|
||||
{
|
||||
if (HasComp<IgnoresFingerprintsComponent>(target))
|
||||
return;
|
||||
|
||||
var component = EnsureComp<ForensicsComponent>(target);
|
||||
if (_inventory.TryGetSlotEntity(user, "gloves", out var gloves))
|
||||
{
|
||||
@@ -175,6 +179,7 @@ namespace Content.Server.Forensics
|
||||
{
|
||||
EnsureComp<ForensicsComponent>(recipient, out var recipientComp);
|
||||
recipientComp.DNAs.Add(donorComp.DNA);
|
||||
recipientComp.CanDnaBeCleaned = canDnaBeCleaned;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,3 +24,5 @@ forensic-scanner-verb-message = Perform a forensic scan
|
||||
|
||||
forensic-pad-fingerprint-name = {$entity}'s fingerprints
|
||||
forensic-pad-gloves-name = fibers from {$entity}
|
||||
|
||||
forensics-cleaning = You begin cleaning the evidence off of {THE($target)}...
|
||||
@@ -162,3 +162,4 @@
|
||||
- type: ExaminableSolution
|
||||
solution: puddle
|
||||
- type: BadDrink
|
||||
- type: IgnoresFingerprints
|
||||
@@ -611,6 +611,6 @@
|
||||
tags:
|
||||
- DroneUsable
|
||||
- Mop
|
||||
- CleansForensics
|
||||
- type: CleansForensics
|
||||
- type: Fiber
|
||||
fiberColor: fibers-white
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Soap
|
||||
- CleansForensics
|
||||
- type: Sprite
|
||||
sprite: Objects/Specific/Janitorial/soap.rsi
|
||||
layers:
|
||||
@@ -69,6 +68,7 @@
|
||||
- type: Food
|
||||
solution: soap
|
||||
- type: BadFood
|
||||
- type: CleansForensics
|
||||
- type: Residue
|
||||
residueAdjective: residue-slippery
|
||||
residueColor: residue-green
|
||||
@@ -137,6 +137,8 @@
|
||||
flavors:
|
||||
- clean
|
||||
- punishment
|
||||
- type: CleansForensics
|
||||
cleanDelay: 8.0
|
||||
- type: Residue
|
||||
residueAdjective: residue-slippery
|
||||
residueColor: residue-red
|
||||
|
||||
@@ -1151,6 +1151,3 @@
|
||||
|
||||
- type: Tag
|
||||
id: boots
|
||||
|
||||
- type: Tag
|
||||
id: CleansForensics
|
||||
|
||||
Reference in New Issue
Block a user