2021-09-15 16:36:43 +02:00
|
|
|
|
using Content.Shared.Examine;
|
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]
|
2023-08-22 18:14:33 -07:00
|
|
|
|
public sealed partial class ComponentConstructionGraphStep : ArbitraryInsertConstructionGraphStep
|
2020-10-08 17:41:23 +02:00
|
|
|
|
{
|
2023-08-22 18:14:33 -07:00
|
|
|
|
[DataField("component")] public string Component { get; private set; } = string.Empty;
|
2020-10-08 17:41:23 +02:00
|
|
|
|
|
2023-01-19 13:57:18 +11:00
|
|
|
|
public override bool EntityValid(EntityUid uid, IEntityManager entityManager, IComponentFactory compFactory)
|
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
|
|
|
|
{
|
2023-01-19 13:57:18 +11:00
|
|
|
|
if (compFactory.GetComponentName(component.GetType()) == Component)
|
2020-10-08 17:41:23 +02:00
|
|
|
|
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
|
|
|
|
{
|
2024-01-05 23:53:13 -07:00
|
|
|
|
examinedEvent.PushMarkup(string.IsNullOrEmpty(Name)
|
2021-12-20 12:42:42 +01: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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|