Files
crystall-punk-14/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs
2022-05-13 17:59:03 +10:00

21 lines
674 B
C#

using Content.Server.Construction.Components;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public sealed class ChangeConstructionNodeBehavior : IThresholdBehavior
{
[DataField("node")]
public string Node { get; private set; } = string.Empty;
public void Execute(EntityUid owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(Node) || !system.EntityManager.TryGetComponent(owner, out ConstructionComponent? construction))
return;
system.ConstructionSystem.ChangeNode(owner, null, Node, true, construction);
}
}
}