1
0

StrapComponent.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System.Numerics;
  2. using Content.Shared.Alert;
  3. using Content.Shared.Whitelist;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.GameStates;
  6. using Robust.Shared.Prototypes;
  7. using Robust.Shared.Serialization;
  8. namespace Content.Shared.Buckle.Components;
  9. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  10. [Access(typeof(SharedBuckleSystem))]
  11. public sealed partial class StrapComponent : Component
  12. {
  13. /// <summary>
  14. /// The entities that are currently buckled to this strap.
  15. /// </summary>
  16. [DataField, AutoNetworkedField]
  17. public HashSet<EntityUid> BuckledEntities = new();
  18. /// <summary>
  19. /// Entities that this strap accepts and can buckle
  20. /// If null it accepts any entity
  21. /// </summary>
  22. [DataField]
  23. public EntityWhitelist? Whitelist;
  24. /// <summary>
  25. /// Entities that this strap does not accept and cannot buckle.
  26. /// </summary>
  27. [DataField]
  28. public EntityWhitelist? Blacklist;
  29. /// <summary>
  30. /// The change in position to the strapped mob
  31. /// </summary>
  32. [DataField, AutoNetworkedField]
  33. public StrapPosition Position = StrapPosition.None;
  34. /// <summary>
  35. /// The buckled entity will be offset by this amount from the center of the strap object.
  36. /// </summary>
  37. [DataField, AutoNetworkedField]
  38. public Vector2 BuckleOffset = Vector2.Zero;
  39. /// <summary>
  40. /// The angle to rotate the player by when they get strapped
  41. /// </summary>
  42. [DataField]
  43. public Angle Rotation;
  44. /// <summary>
  45. /// The size of the strap which is compared against when buckling entities
  46. /// </summary>
  47. [DataField]
  48. public int Size = 100;
  49. /// <summary>
  50. /// If disabled, nothing can be buckled on this object, and it will unbuckle anything that's already buckled
  51. /// </summary>
  52. [DataField, AutoNetworkedField]
  53. public bool Enabled = true;
  54. /// <summary>
  55. /// The sound to be played when a mob is buckled
  56. /// </summary>
  57. [DataField]
  58. public SoundSpecifier BuckleSound = new SoundPathSpecifier("/Audio/Effects/buckle.ogg");
  59. /// <summary>
  60. /// The sound to be played when a mob is unbuckled
  61. /// </summary>
  62. [DataField]
  63. public SoundSpecifier UnbuckleSound = new SoundPathSpecifier("/Audio/Effects/unbuckle.ogg");
  64. /// <summary>
  65. /// ID of the alert to show when buckled
  66. /// </summary>
  67. [DataField]
  68. public ProtoId<AlertPrototype> BuckledAlertType = "Buckled";
  69. /// <summary>
  70. /// How long it takes to buckle someone else into a chair
  71. /// </summary>
  72. [DataField]
  73. public float BuckleDoafterTime = 2f;
  74. /// <summary>
  75. /// Whether InteractHand will buckle the user to the strap.
  76. /// </summary>
  77. [DataField]
  78. public bool BuckleOnInteractHand = true;
  79. }
  80. public enum StrapPosition
  81. {
  82. /// <summary>
  83. /// (Default) Makes no change to the buckled mob
  84. /// </summary>
  85. None = 0,
  86. /// <summary>
  87. /// Makes the mob stand up
  88. /// </summary>
  89. Stand,
  90. /// <summary>
  91. /// Makes the mob lie down
  92. /// </summary>
  93. Down
  94. }
  95. [Serializable, NetSerializable]
  96. public enum StrapVisuals : byte
  97. {
  98. RotationAngle,
  99. State
  100. }