]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make the explosions throw the container/item they originated from (#32428)
authorSaphire Lattice <lattice@saphi.re>
Fri, 4 Oct 2024 08:43:45 +0000 (14:43 +0600)
committerGitHub <noreply@github.com>
Fri, 4 Oct 2024 08:43:45 +0000 (10:43 +0200)
Extra fun if it's something that can trigger multiple times

Content.Server/Explosion/EntitySystems/ExplosionSystem.Processing.cs

index 5f14858f1fab3637634310852317585188adc93c..ca2b0dbf9d1956f6414b774354ada3dae04db6ee 100644 (file)
@@ -488,9 +488,12 @@ public sealed partial class ExplosionSystem
             && physics.BodyType == BodyType.Dynamic)
         {
             var pos = _transformSystem.GetWorldPosition(xform);
+            var dir = pos - epicenter.Position;
+            if (dir.IsLengthZero())
+                dir = _robustRandom.NextVector2().Normalized();
             _throwingSystem.TryThrow(
                 uid,
-                 pos - epicenter.Position,
+                dir,
                 physics,
                 xform,
                 _projectileQuery,