make revenant soft toy construction use tags (#16905)

This commit is contained in:
Chief-Engineer
2023-05-29 01:53:13 -05:00
committed by GitHub
parent a46a4b13d7
commit c3e369cbdd
6 changed files with 17 additions and 35 deletions

View File

@@ -31,11 +31,6 @@ namespace Content.Shared.Construction.Steps
return typeof(TagConstructionGraphStep);
}
if (node.Has("prototype"))
{
return typeof(PrototypeConstructionGraphStep);
}
if (node.Has("allTags") || node.Has("anyTags"))
{
return typeof(MultipleTagsConstructionGraphStep);

View File

@@ -1,27 +0,0 @@
using System.Linq;
namespace Content.Shared.Construction.Steps
{
[DataDefinition]
public sealed class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep
{
[DataField("prototype")]
private string _prototype = "BaseItem";
[DataField("allowParents")]
private bool _allowParents;
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
{
entityManager.TryGetComponent(uid, out MetaDataComponent? metaDataComponent);
if (metaDataComponent?.EntityPrototype == null)
return false;
if (metaDataComponent.EntityPrototype.ID == _prototype)
return true;
if (_allowParents && metaDataComponent.EntityPrototype.Parents != null)
return metaDataComponent.EntityPrototype.Parents.Contains(_prototype);
return false;
}
}
}