]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
DumpableComponent on an empty container no longer stops other interactions (#22831)
authorLordCarve <27449516+LordCarve@users.noreply.github.com>
Fri, 22 Dec 2023 04:26:40 +0000 (05:26 +0100)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2023 04:26:40 +0000 (21:26 -0700)
DumpableComponent does not block the entity from being disposed via InteractOn a DisposalUnit

Content.Shared/Storage/EntitySystems/DumpableSystem.cs

index 1672e27214b244ef114bd998efefa289cd096aeb..cf548693f9d6e69381fcd429ff2915d0a372d0da 100644 (file)
@@ -5,7 +5,6 @@ using Content.Shared.Interaction;
 using Content.Shared.Placeable;
 using Content.Shared.Storage.Components;
 using Content.Shared.Verbs;
-using Robust.Shared.Audio;
 using Robust.Shared.Audio.Systems;
 using Robust.Shared.Containers;
 using Robust.Shared.Random;
@@ -42,6 +41,12 @@ public sealed class DumpableSystem : EntitySystem
         if (!_disposalUnitSystem.HasDisposals(args.Target) && !HasComp<PlaceableSurfaceComponent>(args.Target))
             return;
 
+        if (!TryComp<StorageComponent>(uid, out var storage))
+            return;
+
+        if (!storage.Container.ContainedEntities.Any())
+            return;
+
         StartDoAfter(uid, args.Target.Value, args.User, component);
         args.Handled = true;
     }
@@ -103,12 +108,12 @@ public sealed class DumpableSystem : EntitySystem
         }
     }
 
-    public void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable)
+    private void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable)
     {
         if (!TryComp<StorageComponent>(storageUid, out var storage))
             return;
 
-        float delay = storage.Container.ContainedEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
+        var delay = storage.Container.ContainedEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
 
         _doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, userUid, delay, new DumpableDoAfterEvent(), storageUid, target: targetUid, used: storageUid)
         {