RCDComponent.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Content.Shared.RCD.Systems;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Physics;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.Shared.RCD.Components;
  7. /// <summary>
  8. /// Main component for the RCD
  9. /// Optionally uses LimitedChargesComponent.
  10. /// Charges can be refilled with RCD ammo
  11. /// </summary>
  12. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  13. [Access(typeof(RCDSystem))]
  14. public sealed partial class RCDComponent : Component
  15. {
  16. /// <summary>
  17. /// List of RCD prototypes that the device comes loaded with
  18. /// </summary>
  19. [DataField, AutoNetworkedField]
  20. public HashSet<ProtoId<RCDPrototype>> AvailablePrototypes { get; set; } = new();
  21. /// <summary>
  22. /// Sound that plays when a RCD operation successfully completes
  23. /// </summary>
  24. [DataField]
  25. public SoundSpecifier SuccessSound { get; set; } = new SoundPathSpecifier("/Audio/Items/deconstruct.ogg");
  26. /// <summary>
  27. /// The ProtoId of the currently selected RCD prototype
  28. /// </summary>
  29. [DataField, AutoNetworkedField]
  30. public ProtoId<RCDPrototype> ProtoId { get; set; } = "Invalid";
  31. /// <summary>
  32. /// A cached copy of currently selected RCD prototype
  33. /// </summary>
  34. /// <remarks>
  35. /// If the ProtoId is changed, make sure to update the CachedPrototype as well
  36. /// </remarks>
  37. [ViewVariables(VVAccess.ReadOnly)]
  38. public RCDPrototype CachedPrototype { get; set; } = default!;
  39. /// <summary>
  40. /// The direction constructed entities will face upon spawning
  41. /// </summary>
  42. [DataField, AutoNetworkedField]
  43. public Direction ConstructionDirection
  44. {
  45. get
  46. {
  47. return _constructionDirection;
  48. }
  49. set
  50. {
  51. _constructionDirection = value;
  52. ConstructionTransform = new Transform(new(), _constructionDirection.ToAngle());
  53. }
  54. }
  55. private Direction _constructionDirection = Direction.South;
  56. /// <summary>
  57. /// Returns a rotated transform based on the specified ConstructionDirection
  58. /// </summary>
  59. /// <remarks>
  60. /// Contains no position data
  61. /// </remarks>
  62. [ViewVariables(VVAccess.ReadOnly)]
  63. public Transform ConstructionTransform { get; private set; } = default!;
  64. }