mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 06:42:25 +02:00
Inline GetAllComponents
This commit is contained in:
@@ -248,7 +248,7 @@ namespace Robust.Client.Console.Commands
|
||||
|
||||
shell.WriteLine($"{entity.Uid}: {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype?.ID}/{entity.Name}");
|
||||
shell.WriteLine($"init/del/lmt: {(!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Initialized}/{(!IoCManager.Resolve<IEntityManager>().EntityExists(entity.Uid) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage) >= EntityLifeStage.Deleted}/{IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLastModifiedTick}");
|
||||
foreach (var component in entity.GetAllComponents())
|
||||
foreach (var component in IoCManager.Resolve<IEntityManager>().GetComponents(entity.Uid))
|
||||
{
|
||||
shell.WriteLine(component.ToString() ?? "");
|
||||
if (component is IComponentDebug debug)
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Robust.Client.ViewVariables.Instances
|
||||
_clientComponentsAddButton.OnPressed += OnClientComponentsAddButtonPressed;
|
||||
_clientComponentsSearchBar.OnTextChanged += OnClientComponentsSearchBarChanged;
|
||||
|
||||
var componentList = _entity.GetAllComponents().OrderBy(c => c.GetType().ToString());
|
||||
var componentList = IoCManager.Resolve<IEntityManager>().GetComponents(_entity.Uid).OrderBy(c => c.GetType().ToString());
|
||||
|
||||
foreach (var component in componentList)
|
||||
{
|
||||
|
||||
@@ -805,7 +805,7 @@ namespace Robust.Server.Maps
|
||||
|
||||
var components = new YamlSequenceNode();
|
||||
// See engine#636 for why the Distinct() call.
|
||||
foreach (var component in entity.GetAllComponents())
|
||||
foreach (var component in IoCManager.Resolve<IEntityManager>().GetComponents(entity.Uid))
|
||||
{
|
||||
if (component is MapSaveIdComponent)
|
||||
continue;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Robust.Server.ViewVariables.Traits
|
||||
{
|
||||
var list = new List<ViewVariablesBlobEntityComponents.Entry>();
|
||||
// See engine#636 for why the Distinct() call.
|
||||
foreach (var component in _entity.GetAllComponents())
|
||||
foreach (var component in IoCManager.Resolve<IEntityManager>().GetComponents(_entity.Uid))
|
||||
{
|
||||
var type = component.GetType();
|
||||
list.Add(new ViewVariablesBlobEntityComponents.Entry
|
||||
|
||||
@@ -109,16 +109,6 @@ namespace Robust.Shared.GameObjects
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Uid);
|
||||
}
|
||||
|
||||
public IEnumerable<IComponent> GetAllComponents()
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponents(Uid);
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetAllComponents<T>()
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponents<T>(Uid);
|
||||
}
|
||||
|
||||
#endregion Components
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -30,7 +31,7 @@ namespace Robust.Shared.GameObjects
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityLifeStage = EntityLifeStage.MapInitialized;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(entity.Uid, MapInit, false);
|
||||
foreach (var init in entity.GetAllComponents<IMapInit>())
|
||||
foreach (var init in IoCManager.Resolve<IEntityManager>().GetComponents<IMapInit>(entity.Uid))
|
||||
{
|
||||
init.MapInit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user