Inline GetComponentOrNull

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 15:32:05 +01:00
parent ee4ff9cfe8
commit 2654775bf0
30 changed files with 55 additions and 32 deletions

View File

@@ -18,7 +18,7 @@ namespace Content.Client.Kitchen.Visualizers
base.OnChangeData(component);
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner.Uid);
var microwaveComponent = component.Owner.GetComponentOrNull<MicrowaveComponent>();
var microwaveComponent = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MicrowaveComponent>(component.Owner.Uid);
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out MicrowaveVisualState state))
{

View File

@@ -3,6 +3,7 @@ using Content.Shared.Smoking;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.Smoking
@@ -38,7 +39,7 @@ namespace Content.Client.Smoking
private void SetState(AppearanceComponent component, SmokableState burnState)
{
var clothing = component.Owner.GetComponentOrNull<ClothingComponent>();
var clothing = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ClothingComponent>(component.Owner.Uid);
if (component.Owner.TryGetComponent<ISpriteComponent>(out var sprite))
{