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

@@ -39,7 +39,7 @@ namespace Content.Server.Rotatable
// Check if the object is anchored, and whether we are still allowed to rotate it.
if (!component.RotateWhileAnchored &&
component.Owner.TryGetComponent(out IPhysBody? physics) &&
IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out IPhysBody? physics) &&
physics.BodyType == BodyType.Static)
return;
@@ -76,7 +76,7 @@ namespace Content.Server.Rotatable
/// </summary>
public static void TryFlip(FlippableComponent component, IEntity user)
{
if (component.Owner.TryGetComponent(out IPhysBody? physics) &&
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out IPhysBody? physics) &&
physics.BodyType == BodyType.Static)
{
component.Owner.PopupMessage(user, Loc.GetString("flippable-component-try-flip-is-stuck"));