2021-09-15 16:36:43 +02:00
|
|
|
|
using Content.Shared.Examine;
|
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-06-21 02:13:54 +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
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Shared.Construction.Steps
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataDefinition]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2021-05-04 15:37:16 +02:00
|
|
|
|
[DataField("component")] public string Component { get; } = string.Empty;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
2021-11-09 15:34:40 +01:00
|
|
|
|
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2021-11-09 15:34:40 +01:00
|
|
|
|
foreach (var component in entityManager.GetComponents(uid))
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (component.Name == Component)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-09-15 16:36:43 +02:00
|
|
|
|
public override void DoExamine(ExaminedEvent examinedEvent)
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2021-12-20 12:42:42 +01:00
|
|
|
|
examinedEvent.Message.AddMarkup(string.IsNullOrEmpty(Name)
|
|
|
|
|
|
? 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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|