Inline TryGetComponent completely, for real
This commit is contained in:
@@ -11,6 +11,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
private void Clean()
|
||||
{
|
||||
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner.Uid, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(RecyclerVisuals.Bloody, false);
|
||||
}
|
||||
@@ -48,7 +49,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)
|
||||
{
|
||||
if (victim.TryGetComponent(out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(victim.Uid, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind)
|
||||
{
|
||||
EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, false);
|
||||
mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));
|
||||
@@ -56,7 +57,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others", ("victim",victim)));
|
||||
|
||||
if (victim.TryGetComponent<SharedBodyComponent>(out var body))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent?>(victim.Uid, out var body))
|
||||
{
|
||||
body.Gib(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user