From ec76958b518d722a7fa89cb1840c83f0ef478cb8 Mon Sep 17 00:00:00 2001 From: Justin Pfeifler Date: Tue, 14 Nov 2023 04:52:18 -0600 Subject: [PATCH] Add Check For Gravity On Thrown Items (#21647) --- Content.Shared/Throwing/ThrownItemSystem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Throwing/ThrownItemSystem.cs b/Content.Shared/Throwing/ThrownItemSystem.cs index d7856543e4..2b16b30546 100644 --- a/Content.Shared/Throwing/ThrownItemSystem.cs +++ b/Content.Shared/Throwing/ThrownItemSystem.cs @@ -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(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; -- 2.51.2