Inline TryGetComponent completely
This commit is contained in:
@@ -23,8 +23,8 @@ namespace Content.Server.Actions.Actions
|
||||
|
||||
public void DoInstantAction(InstantActionEventArgs args)
|
||||
{
|
||||
if (!args.Performer.TryGetComponent<ServerUserInterfaceComponent>(out var serverUi)) return;
|
||||
if (!args.Performer.TryGetComponent<ActorComponent>(out var actor)) return;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ServerUserInterfaceComponent?>(args.Performer.Uid, out var serverUi)) return;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(args.Performer.Uid, out var actor)) return;
|
||||
if (!serverUi.TryGetBoundUserInterface(InstrumentUiKey.Key,out var bui)) return;
|
||||
|
||||
bui.Toggle(actor.PlayerSession);
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Actions;
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -29,7 +30,7 @@ namespace Content.Server.Actions.Commands
|
||||
}
|
||||
|
||||
if (attachedEntity == null) return;
|
||||
if (!attachedEntity.TryGetComponent(out ServerActionsComponent? actionsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity.Uid, out ServerActionsComponent? actionsComponent))
|
||||
{
|
||||
shell.WriteLine("user has no actions component");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user