ComponentTogglerComponent.cs 970 B

1234567891011121314151617181920212223242526272829303132
  1. using Content.Shared.Item.ItemToggle;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Prototypes;
  4. namespace Content.Shared.Item.ItemToggle.Components;
  5. /// <summary>
  6. /// Adds or removes components when toggled.
  7. /// Requires <see cref="ItemToggleComponent"/>.
  8. /// </summary>
  9. [RegisterComponent, NetworkedComponent, Access(typeof(ComponentTogglerSystem))]
  10. public sealed partial class ComponentTogglerComponent : Component
  11. {
  12. /// <summary>
  13. /// The components to add when activated.
  14. /// </summary>
  15. [DataField(required: true)]
  16. public ComponentRegistry Components = new();
  17. /// <summary>
  18. /// The components to remove when deactivated.
  19. /// If this is null <see cref="Components"/> is reused.
  20. /// </summary>
  21. [DataField]
  22. public ComponentRegistry? RemoveComponents;
  23. /// <summary>
  24. /// If true, adds components on the entity's parent instead of the entity itself.
  25. /// </summary>
  26. [DataField]
  27. public bool Parent;
  28. }