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

@@ -1,4 +1,7 @@
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Server.Containers
{
@@ -11,7 +14,7 @@ namespace Content.Server.Containers
{
foreach (var entity in container.ContainedEntities)
{
if (entity.Prototype?.ID == prototypeId) total++;
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity.Uid).EntityPrototype?.ID == prototypeId) total++;
if(!entity.TryGetComponent<ContainerManagerComponent>(out var component)) continue;
total += component.CountPrototypeOccurencesRecursive(prototypeId);
}