Inline Prototype

This commit is contained in:
Vera Aguilera Puerto
2021-12-03 11:13:58 +01:00
parent cd43196ea8
commit 70bbd8c502
18 changed files with 54 additions and 38 deletions

View File

@@ -3,6 +3,7 @@ using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using System.Linq;
using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Commands
{
@@ -23,7 +24,7 @@ namespace Content.Server.Administration.Commands
var id = args[0].ToLower();
var entityManager = IoCManager.Resolve<IEntityManager>();
var entities = entityManager.GetEntities().Where(e => e.Prototype?.ID.ToLower() == id);
var entities = entityManager.GetEntities().Where(e => IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(e.Uid).EntityPrototype?.ID.ToLower() == id);
var i = 0;
foreach (var entity in entities)

View File

@@ -5,6 +5,7 @@ using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Server.Administration.Commands
{
@@ -52,12 +53,12 @@ namespace Content.Server.Administration.Commands
foreach (var entity in entitiesWithAllComponents)
{
if (entity.Prototype == null)
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
{
continue;
}
entityIds.Add(entity.Prototype.ID);
entityIds.Add(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.ID);
}
if (entityIds.Count == 0)

View File

@@ -32,7 +32,7 @@ namespace Content.Server.Administration.Commands
foreach (var entity in entityManager.GetEntities())
{
if (checkPrototype && entity.Prototype != prototype || entity.Prototype == null)
if (checkPrototype && IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype != prototype || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype == null)
{
continue;
}
@@ -41,7 +41,7 @@ namespace Content.Server.Administration.Commands
foreach (var component in entity.GetAllComponents())
{
if (entity.Prototype.Components.ContainsKey(component.Name))
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype.Components.ContainsKey(component.Name))
continue;
entityManager.RemoveComponent(entity.Uid, component);