Inline TryGetComponent completely

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 14:05:23 +01:00
parent f3edecf994
commit 2ff4ec65d5
34 changed files with 98 additions and 84 deletions

View File

@@ -7,6 +7,7 @@ using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Server.Buckle.Systems
@@ -40,7 +41,7 @@ namespace Content.Server.Buckle.Systems
{
if (!args.CanAccess || !args.CanInteract || !component.Buckled)
return;
Verb verb = new();
verb.Act = () => component.TryUnbuckle(args.User);
verb.Text = Loc.GetString("verb-categories-unbuckle");
@@ -94,7 +95,7 @@ namespace Content.Server.Buckle.Systems
// This fixes buckle offsets and draw depths.
foreach (var buckledEntity in strap.BuckledEntities)
{
if (!buckledEntity.TryGetComponent(out BuckleComponent? buckled))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(buckledEntity.Uid, out BuckleComponent? buckled))
{
continue;
}
@@ -111,7 +112,7 @@ namespace Content.Server.Buckle.Systems
{
foreach (var buckledEntity in strap.BuckledEntities)
{
if (!buckledEntity.TryGetComponent(out BuckleComponent? buckled))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(buckledEntity.Uid, out BuckleComponent? buckled))
{
continue;
}