Add GHOST GANG! (#13734)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -31,6 +31,11 @@ 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);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user