StunProviderComponent.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using Content.Shared.Damage;
  2. using Content.Shared.Ninja.Systems;
  3. using Content.Shared.Whitelist;
  4. using Robust.Shared.Audio;
  5. using Robust.Shared.GameStates;
  6. namespace Content.Shared.Ninja.Components;
  7. /// <summary>
  8. /// Component for stunning mobs on click outside of harm mode.
  9. /// Knocks them down for a bit and deals shock damage.
  10. /// </summary>
  11. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  12. [Access(typeof(SharedStunProviderSystem))]
  13. public sealed partial class StunProviderComponent : Component
  14. {
  15. /// <summary>
  16. /// The powercell entity to take power from.
  17. /// Determines whether stunning is possible.
  18. /// </summary>
  19. [DataField, AutoNetworkedField]
  20. public EntityUid? BatteryUid;
  21. /// <summary>
  22. /// Sound played when stunning someone.
  23. /// </summary>
  24. [DataField]
  25. public SoundSpecifier Sound = new SoundCollectionSpecifier("sparks");
  26. /// <summary>
  27. /// Joules required in the battery to stun someone. Defaults to 10 uses on a small battery.
  28. /// </summary>
  29. [DataField]
  30. public float StunCharge = 36f;
  31. /// <summary>
  32. /// Damage dealt when stunning someone
  33. /// </summary>
  34. [DataField]
  35. public DamageSpecifier StunDamage = new()
  36. {
  37. DamageDict = new()
  38. {
  39. { "Shock", 5 }
  40. }
  41. };
  42. /// <summary>
  43. /// Time that someone is stunned for, stacks if done multiple times.
  44. /// </summary>
  45. [DataField]
  46. public TimeSpan StunTime = TimeSpan.FromSeconds(5);
  47. /// <summary>
  48. /// How long stunning is disabled after stunning something.
  49. /// </summary>
  50. [DataField]
  51. public TimeSpan Cooldown = TimeSpan.FromSeconds(2);
  52. /// <summary>
  53. /// ID of the cooldown use delay.
  54. /// </summary>
  55. [DataField]
  56. public string DelayId = "stun_cooldown";
  57. /// <summary>
  58. /// Locale string to popup when there is no power
  59. /// </summary>
  60. [DataField(required: true)]
  61. public LocId NoPowerPopup = string.Empty;
  62. /// <summary>
  63. /// Whitelist for what counts as a mob.
  64. /// </summary>
  65. [DataField(required: true)]
  66. public EntityWhitelist Whitelist = new();
  67. }