]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix disposals bins not automatically flushing after an object is inserted (#25233)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Thu, 15 Feb 2024 20:52:52 +0000 (21:52 +0100)
committerGitHub <noreply@github.com>
Thu, 15 Feb 2024 20:52:52 +0000 (15:52 -0500)
Fix disposals bins not automatically flushing after an object is inserted.

Because of Spaghetti Code:tm:, AfterInsert() in DisposalUnitSystem still handles insertion itself. Except in all cases except drag/drop insert, the object is already inserted so this check fails and the remaining logic doesn't happen anymore. Fixed now.

Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs

index 0dfc1ffe0d4fdcc392a48fabf12e6aa93e4d694a..35b2afc2e0f427591eaf042a8e788e2cac67dfd8 100644 (file)
@@ -198,7 +198,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
         if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
             return;
 
-        AfterInsert(uid, component, args.Args.Target.Value, args.Args.User);
+        AfterInsert(uid, component, args.Args.Target.Value, args.Args.User, doInsert: true);
 
         args.Handled = true;
     }
@@ -512,7 +512,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
 
         if (delay <= 0 || userId == null)
         {
-            AfterInsert(unitId, unit, toInsertId, userId);
+            AfterInsert(unitId, unit, toInsertId, userId, doInsert: true);
             return true;
         }
 
@@ -796,11 +796,11 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
         Dirty(component);
     }
 
-    public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null)
+    public void AfterInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid inserted, EntityUid? user = null, bool doInsert = false)
     {
         _audioSystem.PlayPvs(component.InsertSound, uid);
 
-        if (!_containerSystem.Insert(inserted, component.Container))
+        if (doInsert && !_containerSystem.Insert(inserted, component.Container))
             return;
 
         if (user != inserted && user != null)