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

@@ -61,7 +61,7 @@ namespace Content.Server.Buckle.Systems
}
// Add a verb to buckle the user.
if (args.User.TryGetComponent<BuckleComponent>(out var buckle) &&
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<BuckleComponent?>(args.User.Uid, out var buckle) &&
buckle.BuckledTo != component &&
args.User != component.Owner &&
component.HasSpace(buckle) &&
@@ -76,7 +76,7 @@ namespace Content.Server.Buckle.Systems
// If the user is currently holding/pulling an entity that can be buckled, add a verb for that.
if (args.Using != null &&
args.Using.TryGetComponent<BuckleComponent>(out var usingBuckle) &&
IoCManager.Resolve<IEntityManager>().TryGetComponent<BuckleComponent?>(args.Using.Uid, out var usingBuckle) &&
component.HasSpace(usingBuckle) &&
_interactionSystem.InRangeUnobstructed(args.Using, args.Target, range: usingBuckle.Range))
{