Inline TryGetComponent completely
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Storage.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Shared.Storage.EntitySystems
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
|
||||
private void InitLayers(EntityUid uid, ItemMapperComponent component, ComponentInit args)
|
||||
{
|
||||
if (component.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent))
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner.Uid, out AppearanceComponent? appearanceComponent))
|
||||
{
|
||||
var list = new List<string>(component.MapLayers.Keys);
|
||||
appearanceComponent.SetData(StorageMapVisuals.InitLayers, new ShowLayerData(list));
|
||||
@@ -30,7 +31,7 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
private void MapperEntityRemoved(EntityUid uid, ItemMapperComponent itemMapper,
|
||||
EntRemovedFromContainerMessage args)
|
||||
{
|
||||
if (itemMapper.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(itemMapper.Owner.Uid, out AppearanceComponent? appearanceComponent)
|
||||
&& TryGetLayers(args, itemMapper, out var containedLayers))
|
||||
{
|
||||
appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers));
|
||||
@@ -40,7 +41,7 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
private void MapperEntityInserted(EntityUid uid, ItemMapperComponent itemMapper,
|
||||
EntInsertedIntoContainerMessage args)
|
||||
{
|
||||
if (itemMapper.Owner.TryGetComponent(out AppearanceComponent? appearanceComponent)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(itemMapper.Owner.Uid, out AppearanceComponent? appearanceComponent)
|
||||
&& TryGetLayers(args, itemMapper, out var containedLayers))
|
||||
{
|
||||
appearanceComponent.SetData(StorageMapVisuals.LayerChanged, new ShowLayerData(containedLayers));
|
||||
@@ -51,4 +52,4 @@ namespace Content.Shared.Storage.EntitySystems
|
||||
ItemMapperComponent itemMapper,
|
||||
out IReadOnlyList<string> containedLayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user