Inline TryGetComponent completely, for real

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:17:01 +01:00
parent 2ff4ec65d5
commit 69b270017b
425 changed files with 1143 additions and 995 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Physics;
using Content.Shared.Singularity.Components;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
@@ -113,11 +114,11 @@ namespace Content.Server.Singularity.Components
}
if(closestResult == null) continue;
var ent = closestResult.Value.HitEntity;
if (!ent.TryGetComponent<ContainmentFieldGeneratorComponent>(out var fieldGeneratorComponent) ||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ContainmentFieldGeneratorComponent?>(ent.Uid, out var fieldGeneratorComponent) ||
fieldGeneratorComponent.Owner == Owner ||
!fieldGeneratorComponent.HasFreeConnections() ||
IsConnectedWith(fieldGeneratorComponent) ||
!ent.TryGetComponent<PhysicsComponent>(out var collidableComponent) ||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(ent.Uid, out var collidableComponent) ||
collidableComponent.BodyType != BodyType.Static)
{
continue;