1
0

HandcuffComponent.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using Content.Shared.Damage;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.GameStates;
  4. using Robust.Shared.Prototypes;
  5. namespace Content.Shared.Cuffs.Components;
  6. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  7. [Access(typeof(SharedCuffableSystem))]
  8. public sealed partial class HandcuffComponent : Component
  9. {
  10. /// <summary>
  11. /// The time it takes to cuff an entity.
  12. /// </summary>
  13. [DataField, ViewVariables(VVAccess.ReadWrite)]
  14. public float CuffTime = 3.5f;
  15. /// <summary>
  16. /// The time it takes to uncuff an entity.
  17. /// </summary>
  18. [DataField, ViewVariables(VVAccess.ReadWrite)]
  19. public float UncuffTime = 3.5f;
  20. /// <summary>
  21. /// The time it takes for a cuffed entity to uncuff itself.
  22. /// </summary>
  23. [DataField, ViewVariables(VVAccess.ReadWrite)]
  24. public float BreakoutTime = 15f;
  25. /// <summary>
  26. /// If an entity being cuffed is stunned, this amount of time is subtracted from the time it takes to add/remove their cuffs.
  27. /// </summary>
  28. [DataField, ViewVariables(VVAccess.ReadWrite)]
  29. public float StunBonus = 2f;
  30. /// <summary>
  31. /// Will the cuffs break when removed?
  32. /// </summary>
  33. [DataField, ViewVariables(VVAccess.ReadWrite)]
  34. public bool BreakOnRemove;
  35. /// <summary>
  36. /// Will the cuffs break when removed?
  37. /// </summary>
  38. [DataField, ViewVariables(VVAccess.ReadWrite)]
  39. public EntProtoId? BrokenPrototype;
  40. /// <summary>
  41. /// Whether or not these cuffs are in the process of being removed.
  42. /// Used simply to prevent spawning multiple <see cref="BrokenPrototype"/>.
  43. /// </summary>
  44. [DataField]
  45. public bool Removing;
  46. /// <summary>
  47. /// Whether the cuffs are currently being used to cuff someone.
  48. /// We need the extra information for when the virtual item is deleted because that can happen when you simply stop
  49. /// pulling them on the ground.
  50. /// </summary>
  51. [DataField]
  52. public bool Used;
  53. /// <summary>
  54. /// The path of the RSI file used for the player cuffed overlay.
  55. /// </summary>
  56. [DataField, ViewVariables(VVAccess.ReadWrite)]
  57. public string? CuffedRSI = "Objects/Misc/handcuffs.rsi";
  58. /// <summary>
  59. /// The iconstate used with the RSI file for the player cuffed overlay.
  60. /// </summary>
  61. [DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
  62. public string? BodyIconState = "body-overlay";
  63. /// <summary>
  64. /// An opptional color specification for <see cref="BodyIconState"/>
  65. /// </summary>
  66. [DataField, ViewVariables(VVAccess.ReadWrite)]
  67. public Color Color = Color.White;
  68. [DataField, ViewVariables(VVAccess.ReadWrite)]
  69. public SoundSpecifier StartCuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_start.ogg");
  70. [DataField, ViewVariables(VVAccess.ReadWrite)]
  71. public SoundSpecifier EndCuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_end.ogg");
  72. [DataField, ViewVariables(VVAccess.ReadWrite)]
  73. public SoundSpecifier StartBreakoutSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_breakout_start.ogg");
  74. [DataField, ViewVariables(VVAccess.ReadWrite)]
  75. public SoundSpecifier StartUncuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_takeoff_start.ogg");
  76. [DataField, ViewVariables(VVAccess.ReadWrite)]
  77. public SoundSpecifier EndUncuffSound = new SoundPathSpecifier("/Audio/Items/Handcuffs/cuff_takeoff_end.ogg");
  78. }
  79. /// <summary>
  80. /// Event fired on the User when the User attempts to uncuff the Target.
  81. /// Should generate popups on the User.
  82. /// </summary>
  83. [ByRefEvent]
  84. public record struct UncuffAttemptEvent(EntityUid User, EntityUid Target)
  85. {
  86. public readonly EntityUid User = User;
  87. public readonly EntityUid Target = Target;
  88. public bool Cancelled = false;
  89. }
  90. /// <summary>
  91. /// Event raised on an entity being uncuffed to determine any modifiers to the amount of time it takes to uncuff them.
  92. /// </summary>
  93. [ByRefEvent]
  94. public record struct ModifyUncuffDurationEvent(EntityUid User, EntityUid Target, float Duration);