Fixing some warnings (#6250)
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
This commit is contained in:
@@ -10,6 +10,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Shared.Throwing
|
||||
{
|
||||
@@ -54,17 +55,19 @@ namespace Content.Shared.Throwing
|
||||
|
||||
private void ThrowItem(EntityUid uid, ThrownItemComponent component, ThrownEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent) ||
|
||||
physicsComponent.Fixtures.Count != 1) return;
|
||||
if (!EntityManager.TryGetComponent(component.Owner, out FixturesComponent? fixturesComponent) ||
|
||||
fixturesComponent.Fixtures.Count != 1) return;
|
||||
if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent)) return;
|
||||
|
||||
if (_fixtures.GetFixtureOrNull(physicsComponent, ThrowingFixture) != null)
|
||||
if (fixturesComponent.Fixtures.ContainsKey(ThrowingFixture))
|
||||
{
|
||||
Logger.Error($"Found existing throwing fixture on {component.Owner}");
|
||||
return;
|
||||
}
|
||||
|
||||
var shape = physicsComponent.Fixtures[0].Shape;
|
||||
_fixtures.CreateFixture(physicsComponent, new Fixture(physicsComponent, shape) {CollisionLayer = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture});
|
||||
var fixture = fixturesComponent.Fixtures.Values.First();
|
||||
var shape = fixture.Shape;
|
||||
var throwingFixture = new Fixture(physicsComponent, shape) { CollisionLayer = (int) CollisionGroup.ThrownItem, Hard = false, ID = ThrowingFixture };
|
||||
_fixtures.CreateFixture(physicsComponent, throwingFixture, manager: fixturesComponent);
|
||||
}
|
||||
|
||||
private void HandleCollision(EntityUid uid, ThrownItemComponent component, StartCollideEvent args)
|
||||
|
||||
Reference in New Issue
Block a user