Fixing some warnings (#6250)

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
This commit is contained in:
wrexbe
2022-01-21 01:38:35 -08:00
committed by GitHub
parent 29b22e2871
commit cea1b21832
191 changed files with 341 additions and 340 deletions

View File

@@ -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)