]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add Check For Gravity On Thrown Items (#21647)
authorJustin Pfeifler <jrpl101998@gmail.com>
Tue, 14 Nov 2023 10:52:18 +0000 (04:52 -0600)
committerGitHub <noreply@github.com>
Tue, 14 Nov 2023 10:52:18 +0000 (21:52 +1100)
Content.Shared/Throwing/ThrownItemSystem.cs

index d7856543e4ac3d0cb3025449f70bc83a4d857ffd..2b16b30546b81777458cf8ce4b47bb2014a87bfa 100644 (file)
@@ -1,6 +1,7 @@
 using System.Linq;
 using Content.Shared.Administration.Logs;
 using Content.Shared.Database;
+using Content.Shared.Gravity;
 using Content.Shared.Physics;
 using Content.Shared.Physics.Pull;
 using Robust.Shared.Physics;
@@ -21,6 +22,7 @@ namespace Content.Shared.Throwing
         [Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
         [Dependency] private readonly FixtureSystem _fixtures = default!;
         [Dependency] private readonly SharedPhysicsSystem _physics = default!;
+        [Dependency] private readonly SharedGravitySystem _gravity = default!;
 
         private const string ThrowingFixture = "throw-fixture";
 
@@ -111,13 +113,13 @@ namespace Content.Shared.Throwing
                 }
             }
 
-            EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent {User = thrownItemComponent.Thrower}, true);
+            EntityManager.EventBus.RaiseLocalEvent(uid, new StopThrowEvent { User = thrownItemComponent.Thrower }, true);
             EntityManager.RemoveComponent<ThrownItemComponent>(uid);
         }
 
         public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound)
         {
-            if (thrownItem.Landed || thrownItem.Deleted || Deleted(uid))
+            if (thrownItem.Landed || thrownItem.Deleted || _gravity.IsWeightless(uid) || Deleted(uid))
                 return;
 
             thrownItem.Landed = true;