1
0

DamageOnAttackedComponent.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Damage.Components;
  4. /// <summary>
  5. /// This component is added to entities that you want to damage the player
  6. /// if the player interacts with it. For example, if a player tries touching
  7. /// a hot light bulb or an anomaly. This damage can be cancelled if the user
  8. /// has a component that protects them from this.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
  11. public sealed partial class DamageOnAttackedComponent : Component
  12. {
  13. /// <summary>
  14. /// How much damage to apply to the person making contact
  15. /// </summary>
  16. [DataField(required: true), AutoNetworkedField]
  17. public DamageSpecifier Damage = default!;
  18. /// <summary>
  19. /// Whether the damage should be resisted by a person's armor values
  20. /// and the <see cref="DamageOnAttackedProtectionComponent"/>
  21. /// </summary>
  22. [DataField]
  23. public bool IgnoreResistances = false;
  24. /// <summary>
  25. /// What kind of localized text should pop up when they interact with the entity
  26. /// </summary>
  27. [DataField]
  28. public LocId? PopupText;
  29. /// <summary>
  30. /// The sound that should be made when interacting with the entity
  31. /// </summary>
  32. [DataField]
  33. public SoundSpecifier InteractSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
  34. /// <summary>
  35. /// Generic boolean to toggle the damage application on and off
  36. /// This is useful for things that can be toggled on or off, like a stovetop
  37. /// </summary>
  38. [DataField, AutoNetworkedField]
  39. public bool IsDamageActive = true;
  40. }