Some manual GetComponentOrNull inlines

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:09:45 +01:00
parent a5b57c8e10
commit 61be228ad0
10 changed files with 48 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ using Content.Shared.Pulling;
using Content.Shared.Pulling.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Alert.Click
@@ -17,11 +18,10 @@ namespace Content.Server.Alert.Click
public void AlertClicked(ClickAlertEventArgs args)
{
var ps = EntitySystem.Get<SharedPullingSystem>();
var playerTargetPullable = ps.GetPulled(args.Player)?
.GetComponentOrNull<SharedPullableComponent>();
if (playerTargetPullable != null)
var playerTarget = ps.GetPulled(args.Player);
if (playerTarget != null && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget.Uid, out SharedPullableComponent playerPullable))
{
ps.TryStopPull(playerTargetPullable);
ps.TryStopPull(playerPullable);
}
}
}