ChangeConstructionNodeBehavior.cs 707 B

1234567891011121314151617181920
  1. using Content.Server.Construction.Components;
  2. namespace Content.Server.Destructible.Thresholds.Behaviors
  3. {
  4. [Serializable]
  5. [DataDefinition]
  6. public sealed partial class ChangeConstructionNodeBehavior : IThresholdBehavior
  7. {
  8. [DataField("node")]
  9. public string Node { get; private set; } = string.Empty;
  10. public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
  11. {
  12. if (string.IsNullOrEmpty(Node) || !system.EntityManager.TryGetComponent(owner, out ConstructionComponent? construction))
  13. return;
  14. system.ConstructionSystem.ChangeNode(owner, null, Node, true, construction);
  15. }
  16. }
  17. }