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

@@ -82,7 +82,7 @@ namespace Content.Server.Physics.Controllers
continue;
}
if (!pullable.Owner.TryGetComponent<PhysicsComponent>(out var physics) ||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(pullable.Owner.Uid, out var physics) ||
physics.BodyType == BodyType.Static ||
movingTo.MapId != pullable.Owner.Transform.MapID)
{
@@ -119,7 +119,7 @@ namespace Content.Server.Physics.Controllers
var impulse = accel * physics.Mass * frameTime;
physics.ApplyLinearImpulse(impulse);
if (puller.TryGetComponent<PhysicsComponent>(out var pullerPhysics))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(puller.Uid, out var pullerPhysics))
{
pullerPhysics.WakeBody();
pullerPhysics.ApplyLinearImpulse(-impulse);