MeleeSoundComponent.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. using Content.Shared.Damage.Prototypes;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  4. namespace Content.Shared.Weapons.Melee.Components;
  5. /// <summary>
  6. /// Plays the specified sound upon receiving damage of the specified type.
  7. /// </summary>
  8. [RegisterComponent]
  9. public sealed partial class MeleeSoundComponent : Component
  10. {
  11. /// <summary>
  12. /// Specified sounds to apply when the entity takes damage with the specified group.
  13. /// Will fallback to defaults if none specified.
  14. /// </summary>
  15. [DataField("soundGroups",
  16. customTypeSerializer: typeof(PrototypeIdDictionarySerializer<SoundSpecifier, DamageGroupPrototype>))]
  17. public Dictionary<string, SoundSpecifier>? SoundGroups;
  18. /// <summary>
  19. /// Specified sounds to apply when the entity takes damage with the specified type.
  20. /// Will fallback to defaults if none specified.
  21. /// </summary>
  22. [DataField("soundTypes",
  23. customTypeSerializer: typeof(PrototypeIdDictionarySerializer<SoundSpecifier, DamageTypePrototype>))]
  24. public Dictionary<string, SoundSpecifier>? SoundTypes;
  25. /// <summary>
  26. /// Sound that plays if no damage is done.
  27. /// </summary>
  28. [DataField("noDamageSound")] public SoundSpecifier? NoDamageSound;
  29. }