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

@@ -35,7 +35,7 @@ namespace Content.Server.Throwing
{
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted ||
strength <= 0f ||
!entity.TryGetComponent(out PhysicsComponent? physicsComponent))
!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity.Uid, out PhysicsComponent? physicsComponent))
{
return;
}
@@ -94,7 +94,7 @@ namespace Content.Server.Throwing
}
// Give thrower an impulse in the other direction
if (user != null && pushbackRatio > 0.0f && user.TryGetComponent(out IPhysBody? body))
if (user != null && pushbackRatio > 0.0f && IoCManager.Resolve<IEntityManager>().TryGetComponent(user.Uid, out IPhysBody? body))
{
var msg = new ThrowPushbackAttemptEvent();
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(body.Owner.Uid, msg);