Inline TryGetComponent completely, for real
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Shared.Alert;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Alert.Click
|
||||
@@ -16,7 +17,7 @@ namespace Content.Server.Alert.Click
|
||||
{
|
||||
public void AlertClicked(ClickAlertEventArgs args)
|
||||
{
|
||||
if (args.Player.TryGetComponent(out FlammableComponent? flammable))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player.Uid, out FlammableComponent? flammable))
|
||||
{
|
||||
EntitySystem.Get<FlammableSystem>().Resist(args.Player.Uid, flammable);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.Pulling.Components;
|
||||
using Content.Shared.Pulling;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Alert.Click
|
||||
@@ -20,7 +21,7 @@ namespace Content.Server.Alert.Click
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Player.Uid))
|
||||
return;
|
||||
|
||||
if (args.Player.TryGetComponent<SharedPullableComponent>(out var playerPullable))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullableComponent?>(args.Player.Uid, out var playerPullable))
|
||||
{
|
||||
EntitySystem.Get<SharedPullingSystem>().TryStopPull(playerPullable);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Shuttles;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Alert.Click
|
||||
@@ -18,7 +19,7 @@ namespace Content.Server.Alert.Click
|
||||
{
|
||||
public void AlertClicked(ClickAlertEventArgs args)
|
||||
{
|
||||
if (args.Player.TryGetComponent(out PilotComponent? pilotComponent) &&
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player.Uid, out PilotComponent? pilotComponent) &&
|
||||
pilotComponent.Console != null)
|
||||
{
|
||||
EntitySystem.Get<ShuttleConsoleSystem>().RemovePilot(pilotComponent);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Buckle.Components;
|
||||
using Content.Shared.Alert;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Alert.Click
|
||||
@@ -14,7 +16,7 @@ namespace Content.Server.Alert.Click
|
||||
{
|
||||
public void AlertClicked(ClickAlertEventArgs args)
|
||||
{
|
||||
if (args.Player.TryGetComponent(out BuckleComponent? buckle))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player.Uid, out BuckleComponent? buckle))
|
||||
{
|
||||
buckle.TryUnbuckle(args.Player);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Alert.Commands
|
||||
@@ -33,7 +34,7 @@ namespace Content.Server.Alert.Commands
|
||||
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
||||
}
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity.Uid, out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Alert;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Server.Alert.Commands
|
||||
@@ -39,7 +40,7 @@ namespace Content.Server.Alert.Commands
|
||||
if (!CommandUtils.TryGetAttachedEntityByUsernameOrId(shell, target, player, out attachedEntity)) return;
|
||||
}
|
||||
|
||||
if (!attachedEntity.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(attachedEntity.Uid, out ServerAlertsComponent? alertsComponent))
|
||||
{
|
||||
shell.WriteLine("user has no alerts component");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user