DefibrillatorComponent.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Content.Shared.Damage;
  2. using Content.Shared.DoAfter;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Serialization;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  7. namespace Content.Shared.Medical;
  8. /// <summary>
  9. /// This is used for defibrillators; a machine that shocks a dead
  10. /// person back into the world of the living.
  11. /// Uses <c>ItemToggleComponent</c>
  12. /// </summary>
  13. [RegisterComponent, NetworkedComponent]
  14. public sealed partial class DefibrillatorComponent : Component
  15. {
  16. /// <summary>
  17. /// How much damage is healed from getting zapped.
  18. /// </summary>
  19. [DataField("zapHeal", required: true), ViewVariables(VVAccess.ReadWrite)]
  20. public DamageSpecifier ZapHeal = default!;
  21. /// <summary>
  22. /// The electrical damage from getting zapped.
  23. /// </summary>
  24. [DataField("zapDamage"), ViewVariables(VVAccess.ReadWrite)]
  25. public int ZapDamage = 5;
  26. /// <summary>
  27. /// How long the victim will be electrocuted after getting zapped.
  28. /// </summary>
  29. [DataField("writheDuration"), ViewVariables(VVAccess.ReadWrite)]
  30. public TimeSpan WritheDuration = TimeSpan.FromSeconds(3);
  31. /// <summary>
  32. /// ID of the cooldown use delay.
  33. /// </summary>
  34. [DataField]
  35. public string DelayId = "defib-delay";
  36. /// <summary>
  37. /// Cooldown after using the defibrillator.
  38. /// </summary>
  39. [DataField]
  40. public TimeSpan ZapDelay = TimeSpan.FromSeconds(5);
  41. /// <summary>
  42. /// How long the doafter for zapping someone takes
  43. /// </summary>
  44. /// <remarks>
  45. /// This is synced with the audio; do not change one but not the other.
  46. /// </remarks>
  47. [DataField("doAfterDuration"), ViewVariables(VVAccess.ReadWrite)]
  48. public TimeSpan DoAfterDuration = TimeSpan.FromSeconds(3);
  49. [DataField]
  50. public bool AllowDoAfterMovement = true;
  51. [DataField]
  52. public bool CanDefibCrit = true;
  53. /// <summary>
  54. /// The sound when someone is zapped.
  55. /// </summary>
  56. [ViewVariables(VVAccess.ReadWrite), DataField("zapSound")]
  57. public SoundSpecifier? ZapSound = new SoundPathSpecifier("/Audio/Items/Defib/defib_zap.ogg");
  58. [ViewVariables(VVAccess.ReadWrite), DataField("chargeSound")]
  59. public SoundSpecifier? ChargeSound = new SoundPathSpecifier("/Audio/Items/Defib/defib_charge.ogg");
  60. [ViewVariables(VVAccess.ReadWrite), DataField("failureSound")]
  61. public SoundSpecifier? FailureSound = new SoundPathSpecifier("/Audio/Items/Defib/defib_failed.ogg");
  62. [ViewVariables(VVAccess.ReadWrite), DataField("successSound")]
  63. public SoundSpecifier? SuccessSound = new SoundPathSpecifier("/Audio/Items/Defib/defib_success.ogg");
  64. [ViewVariables(VVAccess.ReadWrite), DataField("readySound")]
  65. public SoundSpecifier? ReadySound = new SoundPathSpecifier("/Audio/Items/Defib/defib_ready.ogg");
  66. }
  67. [Serializable, NetSerializable]
  68. public sealed partial class DefibrillatorZapDoAfterEvent : SimpleDoAfterEvent
  69. {
  70. }