EnsnaringComponent.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Ensnaring.Components;
  4. /// <summary>
  5. /// Use this on something you want to use to ensnare an entity with
  6. /// </summary>
  7. [RegisterComponent, NetworkedComponent]
  8. public sealed partial class EnsnaringComponent : Component
  9. {
  10. /// <summary>
  11. /// How long it should take to free someone else.
  12. /// </summary>
  13. [DataField]
  14. public float FreeTime = 3.5f;
  15. /// <summary>
  16. /// How long it should take for an entity to free themselves.
  17. /// </summary>
  18. [DataField]
  19. public float BreakoutTime = 30.0f;
  20. /// <summary>
  21. /// How much should this slow down the entities walk?
  22. /// </summary>
  23. [DataField]
  24. public float WalkSpeed = 0.9f;
  25. /// <summary>
  26. /// How much should this slow down the entities sprint?
  27. /// </summary>
  28. [DataField]
  29. public float SprintSpeed = 0.9f;
  30. /// <summary>
  31. /// How much stamina does the ensnare sap
  32. /// </summary>
  33. [DataField]
  34. public float StaminaDamage = 55f;
  35. /// <summary>
  36. /// How many times can the ensnare be applied to the same target?
  37. /// </summary>
  38. [DataField]
  39. public float MaxEnsnares = 1;
  40. /// <summary>
  41. /// Should this ensnare someone when thrown?
  42. /// </summary>
  43. [DataField]
  44. public bool CanThrowTrigger;
  45. /// <summary>
  46. /// What is ensnared?
  47. /// </summary>
  48. [DataField]
  49. public EntityUid? Ensnared;
  50. /// <summary>
  51. /// Should breaking out be possible when moving?
  52. /// </summary>
  53. [DataField]
  54. public bool CanMoveBreakout;
  55. [DataField]
  56. public SoundSpecifier? EnsnareSound = new SoundPathSpecifier("/Audio/Effects/snap.ogg");
  57. }
  58. /// <summary>
  59. /// Used whenever you want to do something when someone becomes ensnared by the <see cref="EnsnaringComponent"/>
  60. /// </summary>
  61. public sealed class EnsnareEvent : EntityEventArgs
  62. {
  63. public readonly float WalkSpeed;
  64. public readonly float SprintSpeed;
  65. public EnsnareEvent(float walkSpeed, float sprintSpeed)
  66. {
  67. WalkSpeed = walkSpeed;
  68. SprintSpeed = sprintSpeed;
  69. }
  70. }
  71. /// <summary>
  72. /// Used whenever you want to do something when someone is freed by the <see cref="EnsnaringComponent"/>
  73. /// </summary>
  74. public sealed class EnsnareRemoveEvent : CancellableEntityEventArgs
  75. {
  76. public readonly float WalkSpeed;
  77. public readonly float SprintSpeed;
  78. public EnsnareRemoveEvent(float walkSpeed, float sprintSpeed)
  79. {
  80. WalkSpeed = walkSpeed;
  81. SprintSpeed = sprintSpeed;
  82. }
  83. }