Add Check For Gravity On Thrown Items (#21647)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Administration.Logs;
|
using Content.Shared.Administration.Logs;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Gravity;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Physics.Pull;
|
using Content.Shared.Physics.Pull;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
@@ -21,6 +22,7 @@ namespace Content.Shared.Throwing
|
|||||||
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
[Dependency] private readonly SharedBroadphaseSystem _broadphase = default!;
|
||||||
[Dependency] private readonly FixtureSystem _fixtures = default!;
|
[Dependency] private readonly FixtureSystem _fixtures = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||||
|
|
||||||
private const string ThrowingFixture = "throw-fixture";
|
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);
|
EntityManager.RemoveComponent<ThrownItemComponent>(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LandComponent(EntityUid uid, ThrownItemComponent thrownItem, PhysicsComponent physics, bool playSound)
|
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;
|
return;
|
||||||
|
|
||||||
thrownItem.Landed = true;
|
thrownItem.Landed = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user