Removes prototype construction steps (I HATE PROTOTYPE STEPS) (#11611)

This commit is contained in:
Nemanja
2022-10-08 13:47:54 -04:00
committed by GitHub
parent 79854e59a4
commit 5ba36dad25
38 changed files with 182 additions and 137 deletions

View File

@@ -20,11 +20,6 @@ namespace Content.Shared.Construction.Steps
return typeof(ToolConstructionGraphStep);
}
if (node.Has("prototype"))
{
return typeof(PrototypeConstructionGraphStep);
}
if (node.Has("component"))
{
return typeof(ComponentConstructionGraphStep);

View File

@@ -1,31 +0,0 @@
using Content.Shared.Examine;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Construction.Steps
{
[DataDefinition]
public sealed class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep
{
[DataField("prototype", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>), required:true)]
public string Prototype { get; } = string.Empty;
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
{
return entityManager.GetComponent<MetaDataComponent>(uid).EntityPrototype?.ID == Prototype;
}
public override void DoExamine(ExaminedEvent examinedEvent)
{
examinedEvent.Message.AddMarkup(string.IsNullOrEmpty(Name)
? Loc.GetString(
"construction-insert-prototype-no-name",
("prototypeName", Prototype) // Terrible.
)
: Loc.GetString(
"construction-insert-prototype",
("entityName", Name)
));
}
}
}

View File

@@ -6,11 +6,11 @@ namespace Content.Shared.Construction.Steps
public sealed class TagConstructionGraphStep : ArbitraryInsertConstructionGraphStep
{
[DataField("tag")]
private string? _tag = null;
private string? _tag;
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
{
var tagSystem = EntitySystem.Get<TagSystem>();
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
return !string.IsNullOrEmpty(_tag) && tagSystem.HasTag(uid, _tag);
}
}