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

@@ -303,9 +303,9 @@ namespace Content.Server.Physics.Controllers
mobMover.StepSoundDistance -= distanceNeeded;
if (mover.Owner.TryGetComponent<InventoryComponent>(out var inventory)
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(mover.Owner.Uid, out var inventory)
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
&& item.Owner.TryGetComponent<FootstepModifierComponent>(out var modifier))
&& IoCManager.Resolve<IEntityManager>().TryGetComponent<FootstepModifierComponent?>(item.Owner.Uid, out var modifier))
{
modifier.PlayFootstep();
}

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