]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup forensic cleaning (#22715)
authorthemias <89101928+themias@users.noreply.github.com>
Thu, 21 Dec 2023 08:54:52 +0000 (03:54 -0500)
committerGitHub <noreply@github.com>
Thu, 21 Dec 2023 08:54:52 +0000 (01:54 -0700)
* Cleanup forensic cleaning

* move cleandelay to new component; buff syndiesoap

* updated based on feedback

* remove tag

Content.Server/Forensics/Components/CleansForensicsComponent.cs [new file with mode: 0644]
Content.Server/Forensics/Components/ForensicsComponent.cs
Content.Server/Forensics/Components/IgnoresFingerprintsComponent.cs [new file with mode: 0644]
Content.Server/Forensics/Systems/ForensicsSystem.cs
Resources/Locale/en-US/forensics/forensics.ftl
Resources/Prototypes/Entities/Effects/puddle.yml
Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml
Resources/Prototypes/Entities/Objects/Specific/Janitorial/soap.yml
Resources/Prototypes/tags.yml

diff --git a/Content.Server/Forensics/Components/CleansForensicsComponent.cs b/Content.Server/Forensics/Components/CleansForensicsComponent.cs
new file mode 100644 (file)
index 0000000..a1f40c9
--- /dev/null
@@ -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;
+}
index 27eccf3334a540734e811796f7a3dc2593218075..e4579c5f3aad980f9ed4813d011474d30a2f5489 100644 (file)
@@ -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;
diff --git a/Content.Server/Forensics/Components/IgnoresFingerprintsComponent.cs b/Content.Server/Forensics/Components/IgnoresFingerprintsComponent.cs
new file mode 100644 (file)
index 0000000..4ecaf84
--- /dev/null
@@ -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 { }
index 3c6d1d30afd9b5d11b684f1ae61a06a687686dba..16bd2a50ee26a81d5f949fc137214abee34599b9 100644 (file)
@@ -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;
             }
         }
 
index 2326aeb9c21ec2e59258c2b0a325fd216b0bd276..957cc444a8cdfeb46ec94a312d00ef9d12cbc12a 100644 (file)
@@ -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)}...
\ No newline at end of file
index fe31e2bb1c426d1479d7853b8b9dce551a3fe918..2ddde99ebb58a79e1bb36744d6520868279c7957 100644 (file)
   - type: ExaminableSolution
     solution: puddle
   - type: BadDrink
+  - type: IgnoresFingerprints
\ No newline at end of file
index 4119b12a46b843f15c33e6c43cbf8dfbe1f11aa2..be823f2b653768d6f907d9e406a773406e67e8e0 100644 (file)
       tags:
         - DroneUsable
         - Mop
-        - CleansForensics
+    - type: CleansForensics
     - type: Fiber
       fiberColor: fibers-white
index 5905c6b12880b97c7e89bc355b100071e13c55c6..4defea6264124e2e3d4dbf9a22ecc23694e5e342 100644 (file)
@@ -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
     flavors:
       - clean
       - punishment
+  - type: CleansForensics
+    cleanDelay: 8.0
   - type: Residue
     residueAdjective: residue-slippery
     residueColor: residue-red
index 0a5044b84849a817ce1cc27c0d8c8fb18d0dac5f..8cb13ab8b6208372651fd9325511ce63385f8603 100644 (file)
   id: MindShield
 
 - type: Tag
-  id:  boots
-
-- type: Tag
-  id: CleansForensics
+  id:  boots
\ No newline at end of file