Files
crystall-punk-14/Content.Server/Destructible/Thresholds/Behaviors/ChangeConstructionNodeBehavior.cs
2021-07-16 17:37:09 -07:00

27 lines
754 B
C#

using System;
using Content.Server.Construction.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Destructible.Thresholds.Behaviors
{
[Serializable]
[DataDefinition]
public class ChangeConstructionNodeBehavior : IThresholdBehavior
{
[DataField("node")]
public string Node { get; private set; } = string.Empty;
public async void Execute(IEntity owner, DestructibleSystem system)
{
if (string.IsNullOrEmpty(Node) ||
!owner.TryGetComponent(out ConstructionComponent? construction))
{
return;
}
await construction.ChangeNode(Node);
}
}
}