NinjaGlovesComponent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Content.Shared.Ninja.Systems;
  2. using Content.Shared.Objectives.Components;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Shared.Ninja.Components;
  7. /// <summary>
  8. /// Component for toggling glove powers.
  9. /// </summary>
  10. /// <remarks>
  11. /// Requires <c>ItemToggleComponent</c>.
  12. /// </remarks>
  13. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  14. [Access(typeof(SharedNinjaGlovesSystem))]
  15. public sealed partial class NinjaGlovesComponent : Component
  16. {
  17. /// <summary>
  18. /// Entity of the ninja using these gloves, usually means enabled
  19. /// </summary>
  20. [DataField, AutoNetworkedField]
  21. public EntityUid? User;
  22. /// <summary>
  23. /// Abilities to give to the user when enabled.
  24. /// </summary>
  25. [DataField(required: true)]
  26. public List<NinjaGloveAbility> Abilities = new();
  27. }
  28. /// <summary>
  29. /// An ability that adds components to the user when the gloves are enabled.
  30. /// </summary>
  31. [DataRecord]
  32. public partial record struct NinjaGloveAbility()
  33. {
  34. /// <summary>
  35. /// If not null, checks if an objective with this prototype has been completed.
  36. /// If it has, the ability components are skipped to prevent doing the objective twice.
  37. /// The objective must have <c>CodeConditionComponent</c> to be checked.
  38. /// </summary>
  39. [DataField]
  40. public EntProtoId<ObjectiveComponent>? Objective;
  41. /// <summary>
  42. /// Components to add and remove.
  43. /// </summary>
  44. [DataField(required: true)]
  45. public ComponentRegistry Components = new();
  46. }