2021-02-27 04:12:09 +01:00
|
|
|
|
#nullable enable
|
2021-02-22 00:07:46 +00:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using Robust.Shared.Localization;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Construction
|
|
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2020-10-08 17:41:23 +02:00
|
|
|
|
public class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
|
|
|
|
|
{
|
2021-05-04 15:37:16 +02:00
|
|
|
|
[DataField("component")] public string Component { get; } = string.Empty;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
|
|
|
|
|
public override bool EntityValid(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var component in entity.GetAllComponents())
|
|
|
|
|
|
{
|
|
|
|
|
|
if (component.Name == Component)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void DoExamine(FormattedMessage message, bool inDetailsRange)
|
|
|
|
|
|
{
|
|
|
|
|
|
message.AddMarkup(string.IsNullOrEmpty(Name)
|
2021-02-22 00:07:46 +00:00
|
|
|
|
? Loc.GetString(
|
|
|
|
|
|
"construction-insert-entity-with-component",
|
|
|
|
|
|
("componentName", Component))// Terrible.
|
|
|
|
|
|
: Loc.GetString(
|
|
|
|
|
|
"construction-insert-exact-entity",
|
|
|
|
|
|
("entityName", Name)));
|
2020-10-08 17:41:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|