]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fixes debug assertion thrown when spiking with pills (#34813)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Sun, 2 Feb 2025 19:38:34 +0000 (11:38 -0800)
committerGitHub <noreply@github.com>
Sun, 2 Feb 2025 19:38:34 +0000 (20:38 +0100)
Content.Shared/Chemistry/EntitySystems/SolutionSpikerSystem.cs

index f179580604c9a98faefbafe21596cd8740bf2019..468e28f65fd2ec341427fd10df2d45b53fea526e 100644 (file)
@@ -26,7 +26,8 @@ public sealed class SolutionSpikerSystem : EntitySystem
 
     private void OnInteractUsing(Entity<RefillableSolutionComponent> entity, ref InteractUsingEvent args)
     {
-        TrySpike(args.Used, args.Target, args.User, entity.Comp);
+        if (TrySpike(args.Used, args.Target, args.User, entity.Comp))
+            args.Handled = true;
     }
 
     /// <summary>
@@ -36,7 +37,7 @@ public sealed class SolutionSpikerSystem : EntitySystem
     /// <param name="source">Source of the solution.</param>
     /// <param name="target">Target to spike with the solution from source.</param>
     /// <param name="user">User spiking the target solution.</param>
-    private void TrySpike(EntityUid source, EntityUid target, EntityUid user, RefillableSolutionComponent? spikableTarget = null,
+    private bool TrySpike(EntityUid source, EntityUid target, EntityUid user, RefillableSolutionComponent? spikableTarget = null,
         SolutionSpikerComponent? spikableSource = null,
         SolutionContainerManagerComponent? managerSource = null,
         SolutionContainerManagerComponent? managerTarget = null)
@@ -46,21 +47,23 @@ public sealed class SolutionSpikerSystem : EntitySystem
             || !_solution.TryGetRefillableSolution((target, spikableTarget, managerTarget), out var targetSoln, out var targetSolution)
             || !_solution.TryGetSolution((source, managerSource), spikableSource.SourceSolution, out _, out var sourceSolution))
         {
-            return;
+            return false;
         }
 
         if (targetSolution.Volume == 0 && !spikableSource.IgnoreEmpty)
         {
             _popup.PopupClient(Loc.GetString(spikableSource.PopupEmpty, ("spiked-entity", target), ("spike-entity", source)), user, user);
-            return;
+            return false;
         }
 
         if (!_solution.ForceAddSolution(targetSoln.Value, sourceSolution))
-            return;
+            return false;
 
         _popup.PopupClient(Loc.GetString(spikableSource.Popup, ("spiked-entity", target), ("spike-entity", source)), user, user);
         sourceSolution.RemoveAllSolution();
         if (spikableSource.Delete)
             QueueDel(source);
+
+        return true;
     }
 }