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

@@ -6,6 +6,7 @@ using Content.Shared.Interaction.Helpers;
using Content.Shared.Inventory;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Players;
@@ -117,7 +118,7 @@ namespace Content.Shared.Item
if (user.Transform.MapID != Owner.Transform.MapID)
return false;
if (!Owner.TryGetComponent(out IPhysBody? physics) || physics.BodyType == BodyType.Static)
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
return false;
return user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true, popup: popup);
@@ -140,7 +141,7 @@ namespace Content.Shared.Item
if (!CanPickup(user))
return false;
if (!user.TryGetComponent(out SharedHandsComponent? hands))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user.Uid, out SharedHandsComponent? hands))
return false;
var activeHand = hands.ActiveHand;